Announcing exports for the dbt Semantic Layer
Today, we’re excited to launch exports for the dbt Semantic Layer. Now, regardless of what analytics tools your organization uses, you can make the metrics you define in the dbt Semantic Layer accessible to your downstream teams. The dbt Semantic Layer allows you to easily query metrics and dimensions on the fly in a number of downstream analytics tools. We believe the dbt Semantic Layer is most powerful when you can query dynamically—which is why we’re hard at work building native integrations across the analytics ecosystem— but we recognize there’s a lot of work to do to make that vision viable for all tools and all use cases. Enter: exports.
Exports allow you to materialize a saved query as a table or view in your data platform. By using exports, you can unify metric definitions in your data platform and query them as you would any other table or view. This provides an integration path for tools that don’t yet have a native integration with the dbt Semantic Layer. If you’re familiar with the now-deprecated dbt metrics package, think
metrics.calculate(), but for the new dbt Semantic Layer 🎉. Exports are now generally available to dbt Cloud customers on dbt 1.7 or later.
Bridging semantic models to any downstream tool with exports
You may be wondering: how is an export different than a dbt model? A dbt model is a SQL file containing a
select statement. Exports query the dbt Semantic Layer directly, using MetricFlow to generate SQL based on your metric configurations. We materialize this semantic layer query in your data platform, where you can get direct access to governed metric definitions.
While exports are not dynamic, they solve a few important problems:
- They provide an integration path for tools we don’t currently have a first-class integration with, such as Power BI
- They enable the pre-materialization of metrics to specific granularities for supporting your most critical low-latency use cases (we’re working on caching to make this unnecessary!)
- They allow you to take snapshots for retaining records of historical metric values
How to start using exports
To set up an export, you must be a dbt Cloud user and have a saved query defined in your dbt project. A saved query is simply a semantic layer query that you express in YAML. Exports are an additional configuration for a saved query that define the materialization strategy, as well as the name and schema for the export.
Next, you need to run your export through dbt Cloud’s job scheduler. For a given environment, set the environment variable
DBT_INCLUDE_SAVED_QUERY=TRUE. This will run any saved queries and exports as part of your DAG when you run
dbt build. Since saved queries are part of your DAG, you can use the selector syntax to customize which exports run, giving you control over when these exports are refreshed. Check out the quick product demo below which runs through how to define, build, and query an export.
We’re excited to launch exports, as it’s a valuable step to help our customers make metrics accessible to their entire organization—regardless of what analytics tools they leverage. Exports are now generally available to dbt Cloud customers on dbt 1.7 or later.
For more information, and to get started with exports, visit our docs.
Last modified on: Feb 7, 2024