In dbt (data build tool), exposure is a configuration that documents how external tools or resources use your data models. Think of it as a bridge between your dbt project and end products like dashboards, reports, or machine learning pipelines.
While exposures are mainly used for documentation and visibility, they can also help you in testing. Let’s say you want to tweak a data model. With exposures, you can instantly see what downstream tools will be affected, so you can test just what matters, not everything.
Table of Contents
Types of dbt Exposures
Exposures are divided into two categories:
1. Manual Exposures
Manual exposures are your way of telling dbt, “Hey, this model powers that dashboard (or ML model, or report).”
You define them yourself — in plain English — inside a .yml file in your dbt project.
They don’t just improve documentation. They give your team visibility into how your data is being used, and what might break if something changes.
2. Automatic Exposures:
In automatic exposures, dbt itself detects how your models are being used; you don’t need to define them manually. This typically happens when using the dbt cloud, which automatically detects exposures.
These exposures live in the dbt metadata system and show up in dbt Explorer, giving you the same visibility as manual ones.
Why dbt Exposures?
In a dbt project with many data models, downstream teams — like analysts and scientists — rely on those models for dashboards, tools, and reports. Exposures help you track which external resources use which models. This gives teams more confidence when collaborating, makes it easier to understand data usage, and clarifies the impact of any model changes.
How do Exposures Work in dbt?
Exposures in dbt are defined in a YAML (.yml) file, where you can configure details like how your data models are connected to external resources. Here are the key parts of an exposure and what each one means:
Key Components
Name: The name of the exposure refers to the external tool or resource.
Type: This defines what kind of exposure it is. Some common types include dashboards, machine learning, and reports.
- Dashboard: A visualization tool that presents data insights to teams.
- Machine Learning (ML): Exposures used in machine learning pipelines.
- Reports: Static or scheduled reports built from your models. r
Maturity Level: The maturity level tells how stable or ready the exposure is. You can set it to low, medium, or high.
- Low: The exposure is still in development or testing.
- Medium: The exposure is in use, but it may still change.
- High: The exposure is stable or well-tested and widely used.
URL: You can use the URL property to link directly to the external tool, like a live dashboard, report, or app, for quick and easy access.
Depends_on : This is the key part. It specifies which models the particular exposure depends on. You typically use ref, source, or metric functions to declare these dependencies.
ref( )
– This function is mainly used to reference other models in your dbt project.source( )
– The source( ) function references data sources outside your dbt project, such as CSV files and database tables.metrics( )
– It references pre-defined metrics that track aggregated values, such as revenue, count, or average
Owner: This is the person or team responsible for the exposure, usually someone who can answer questions about it.
Example:
exposures:
- name: employee_attendance_dashboard
type: dashboard
description: "Used by the HR teams to monitor employee attendance, leaves, and late arrivals across departments."
depends_on: - ref('daily_attendance_model')
- ref('employee_leave_summary_model')
owner: name: HR Team
email: hr@yourcompany.com
maturity: high
url: https://hr.yourcompany.com/attendance-overview
View Exposures in dbt Docs
Once you define your exposures in your dbt project, they will automatically appear in your dbt documentation. This makes it easy for everyone to see which data models are used in the dashboard or reports.
Follow these commands to generate and view the documentation locally:
- Execute: dbt docs generate
- Then serve it with: dbt docs serve
This opens a local documentation site where you’ll see your exposures listed, along with key details like owner, type, and which models they depend on.
dbt Exposure Commands
Once you’ve defined exposures in your dbt project, you can use them on the command line to run, test, or list only the models linked to those exposures. It helps you target just the parts that matter—like the ones powering a specific dashboard or report.
1. dbt run -s +exposure:<name>
This command runs all the models used in a specific exposure. It checks what your dashboard or tool relies on and runs only those models. So, if you’re working on a model feeding into a dashboard, you don’t need to run the whole project—just the relevant models. This saves time and makes testing more efficient.
2. dbt test -s +exposure:<name>
This command runs all tests for the models linked to a specific exposure. If you’re making changes to your model, it allows you to test only the relevant parts, instead of running tests for the entire project. This keeps the process focused and efficient.
3. dbt ls -s +exposure:<name>
This command lists all the models that a specific exposure depends on. It’s perfect for understanding which data sources or models a dashboard is using, helping you quickly trace the flow of data.
Conclusion
dbt exposures are a powerful way to connect your data models with the tools and teams that use them. Whether it’s dashboards, reports, or machine learning pipelines, exposures provide clear visibility into how data flows through your project.
They are useful during audits or when onboarding new team members, as the documentation is automatically generated and always up to date. They not only improve documentation but also make it easier to manage changes.
By using exposures, you can make your dbt project more transparent, more organized, and more useful for everyone, from developers to business users. If you want better visibility and smoother teamwork across your organization, exposures are a great place to start.
And if you’re looking to streamline data transformations within your warehouse, try Hevo Transformer — a seamless way to build and manage dbt Core-compatible transformations with zero setup.
Frequently Asked Questions
1. What are the best practices for dbt exposures?
Best practices for dbt exposures include clearly documenting all external dependencies, using consistent naming, assigning responsible owners, linking to dashboards or tools via URLs, and regularly updating exposure definitions to reflect changes in usage. This ensures better visibility, easier impact analysis, and smoother collaboration across teams.
2. What is an exposure in dbt?
An exposure in dbt is a way to document how your data models are used by external tools like dashboards, reports, or ML pipelines. It helps teams track dependencies, improve visibility, and manage changes more effectively.