Apache Ossie semantic layer documents
dbt Core v1.12 and higher supports the Apache Ossie standard for defining semantic models and metrics. You can place Ossie-format .json files in an osi/ directory at the root of your project, or configure osi-paths in dbt_project.yml to use one or more custom directories relative to your project root. dbt parses them into the manifest alongside any native dbt semantic models. Ossie-sourced definitions and native dbt semantic models can coexist in the same project.
Prerequisites
- You must be on dbt Core v1.12 or higher.
- Ossie documents must use version
0.1.0or0.1.1. Any other version string raises a parse error.
Defining semantic models using Ossie documents
To define semantic models with Ossie documents:
-
Create an
osi/directory at the root of your dbt project, at the same level asdbt_project.yml. To use one or more custom directories instead, configureosi-pathsindbt_project.ymlwith paths relative to your project root. -
Add one or more Ossie
.jsonfiles to the directory. You can organize files into subdirectories; dbt scans the entire 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 Ossie 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 Ossie specification. -
Run any command that triggers compilation, such as
dbt compileordbt run. dbt automatically discovers and parses Ossie files.
The resulting semantic models (and metrics, when defined in your Ossie 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 Ossie directories (configured through
osi-paths, defaultosi/). Ossie files in installed dependency packages are ignored. - Each Ossie dataset source must resolve to a dbt model. Ossie documents that reference sources, seeds, snapshots, or external tables are not supported.
- If the Ossie 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.