OSI semantic layer documents Beta
dbt Core v1.12 and higher supports the Open Semantic Interchange (OSI) standard for defining semantic models and metrics. You can place OSI-format .json files in an OSI/ directory at the root of your project, and dbt parses them into the manifest alongside any native dbt semantic models. OSI-sourced definitions and native dbt semantic models can coexist in the same project.
Prerequisites​
- You must be on dbt Core v1.12 or higher.
- OSI documents must use version
0.1.0or0.1.1. Any other version string raises a parse error.
Defining semantic models using OSI documents​
To define semantic models with OSI documents:
-
Create an
OSI/directory at the root of your dbt project, at the same level asdbt_project.yml. -
Add one or more OSI
.jsonfiles to the directory. You can organize files into subdirectories; dbt scans the entireOSI/directory tree.The
sourcefield must be the fully qualified warehouse location of a dbt model in this project, in the formdatabase.schema.alias(for example,my_database.my_schema.fct_orders). dbt matches each dataset on database, schema, and model alias. Each datasetsourcemust resolve to a dbt model. For restrictions on dataset sources, refer to Limitations.The following is an example OSI document that defines a semantic model on a dbt model called
fct_orders:{
"version": "0.1.1",
"semantic_model": [
{
"name": "orders",
"datasets": [
{
"name": "orders",
"source": "my_database.my_schema.fct_orders"
}
]
}
]
}This example defines a semantic model only. To add metrics, include a
metricsarray on the semantic model per the OSI specification. -
Run any command that triggers compilation, such as
dbt compileordbt run. dbt automatically discovers and parses OSI files.
The resulting semantic models (and metrics, when defined in your OSI documents) appear in dbt artifacts in your target/ directory, including manifest.json, semantic_manifest.json, and osi_document.json.
Limitations​
- dbt scans only the root project's
OSI/directory. OSI files in installed dependency packages are ignored. - Each OSI dataset source must resolve to a dbt model. OSI documents that reference sources, seeds, snapshots, or external tables are not supported.
- If the OSI converter encounters unsupported metric types or other constructs, those elements are dropped and dbt emits a warning (event code
I078), but parsing continues. Warnings appear in the CLI and inlogs/dbt.log; for more information, refer to Events and logs.
Was this page helpful?
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.