Overview
A semantic model is a conceptual representation of data that defines business terms, metrics, relationships, and rules in a way that makes sense to business users. It’s essentially a blueprint that maps raw data into business-friendly concepts. Think of it like translating technical database schemas into business terminology.Oxy also supports a more structured semantic layer approach using views and topics. See the Semantic Layer documentation for an alternative way to organize your semantic definitions.
Organization and Formatting Rules
- A semantic model should be organized under the
datafolder. - Use the
.sem.ymlextension to distinguish it from other files in thedatafolder. e.g.finance.sem.yml
Core Components
Let’s take a look at Semantic model components:| Component | Description | Required |
|---|---|---|
| table | Specifies the source table | Required |
| database | The database that the table is used within | Required |
| description | A description of the table | Required |
| entities | Represents unique identifiers that define the grain of analysis | Required |
| dimensions | Defines attributes used to slice and filter data | Required |
| measures | Defines business metrics with specific aggregation rules | Required |
entities, dimensions, and measures keys, the following fields are allowed:
| Component | Description | Required |
|---|---|---|
| name | Column name | Required |
| description | Description of the column | Optional |
| synonyms | Synonyms for this column | Optional |
| sample | A sample of values for this column | Optional |
measures key, the following fields attributes are available:
| Component | Description | Required |
|---|---|---|
| sql | Snippet of SQL that defines the calculation. For pre-aggregated data, this can just be a column name. | Required |
Sample semantic model config
The following example displays a complete configuration:data/anon_youtube.sem.yml
How to enable use of semantic model in agents
For agents to utilize the semantic model, you need to include the semantic model in thecontext section of your agent config.