Integrate dbt with Hex
Bring what you already manage in dbt into Hex. dbt metadata enriches your Hex data connections. MetricFlow definitions become Hex semantic models that people and agents can use for analysis.
| What you have in dbt | Where it connects in Hex | What you can do |
|---|---|---|
| dbt metadata descriptions, tests, and source freshness | Data connections | Enrich tables and columns in the Data browser using the dbt platform or descriptions persisted to your warehouse. |
| dbt Semantic Layer MetricFlow semantic models and metrics | Semantic models | Bring dimensions, metrics, and relationships into a semantic project for use in analysis and agent context. |
dbt metadata
Connect dbt metadata to a Hex data connection to help people understand and trust the tables and columns they find in the Data browser.
- dbt platform metadata: Configure the dbt metadata integration on a data connection to bring in model, source, and column descriptions, test results, and freshness information. This integration uses the dbt platform (formerly dbt Cloud) Discovery API. Hex refreshes the metadata when the connection's schema refreshes.
- Warehouse descriptions from dbt Core or other dbt projects: Use dbt's
persist_docsconfiguration to write table and column descriptions to your warehouse, where Hex can read them through the data connection. This does not import tests or build information. See how to use warehouse descriptions.
dbt Semantic Layer
The dbt Semantic Layer integrates into Hex primarily through conversion of the underlying MetricFlow definitions.
MetricFlow
The MetricFlow definitions that specify semantic models, metrics, and dimensions become Hex semantic models. A Hex semantic project groups reusable models, dimensions, measures, and joins connected to a data connection. The imported definitions are available for analysis in the Data browser and Explore, as well as context for Hex agents.
Using the Hex semantic models generated from your MetricFlow definitions only requires a data connection to the underlying warehouse tables. It does not require configuring dbt on your data connection.
Specifications
MetricFlow definitions are annotations on your dbt models and columns. Hex supports both dbt Semantic Layer specifications (latest and legacy). Converting the latest spec requires using Hex's latest conversion path with Apache Ossie.
| dbt YAML | dbt versions | Where definitions live | Use in Hex |
|---|---|---|---|
| Latest spec | dbt platform (Latest) dbt v1.12+ (Core) dbt v2 (Fusion) | Alongside dbt models and columns | Convert with Apache Ossie |
| Legacy spec | dbt v1.6+ (Core) | Separate semantic_models resources | Convert directly |
Conversion
Convert with Apache Ossie
Hex recommends converting your dbt semantic manifest through Apache Ossie and syncing the result to a Hex semantic project with Context Sync. This path supports both dbt Semantic Layer formats.
To get started, review Sync semantic models with dbt Metricflow.
Convert directly (legacy integration)
Hex also maintains a legacy integration where you can send your dbt project to Hex directly for conversion. This method only supports the legacy dbt specification.
To get started, review the legacy integration guide.
Metrics
The Metrics defined in your dbt project come along when converting MetricFlow to Hex as measures in Hex semantic models. This is the recommended way to consume dbt Metrics in Hex.
Querying directly (legacy integration)
Alternatively, you can query the dbt Semantic Layer API directly through data connection configuration. This supports dbt Semantic layer cells in Hex projects. For setup and limitations, see dbt Semantic Layer integration.
This integration is deprecated in favor of converting the underlying MetricFlow definitions into Hex semantic models. Using the legacy integration with dbt Semantic Layer on a Hex data connection breaks prepared statements required by Explore's no-code filtering.