Skip to main content

Exposure Types

In dbt, the Directed Acyclic Graph (DAG) usually ends with your marts models.

But data doesn't just sit in the warehouse. It is consumed by external tools: Tableau dashboards, Jupyter Notebooks, or downstream Machine Learning models.

If you delete a column in dim_customers, how do you know if it will break a dashboard? You use Exposures. Exposures allow you to document downstream dependencies outside of dbt, extending your DAG all the way to the end consumer.

Topics Covered​

  • Defining an Exposure
  • The Four Exposure Types
  • Viewing Exposures in dbt Docs

1. Defining an Exposure​

Exposures are defined purely in YAML files (usually in a dedicated exposures.yml file, or alongside your models in schema.yml).

An exposure requires three critical pieces of information:

  1. The Type of the downstream consumer.
  2. The Owner (who to contact if it breaks).
  3. The Dependencies (which dbt models does this exposure read from?).

Hands-On: Writing an Exposure​

Let's assume our business analysts in Mumbai built a Tableau dashboard tracking daily revenue.

# models/marts/exposures.yml
version: 2

exposures:
- name: daily_revenue_dashboard
label: "Daily Revenue Executive Dashboard"
type: dashboard # The Exposure Type
url: "https://tableau.beems.tech/views/daily_revenue"
description: >
This dashboard is used by the CEO to track daily sales metrics across all Indian regions.

# Who owns this dashboard?
owner:
name: Priya Sharma
email: priya.sharma@beems.tech

# What dbt models does this dashboard query?
depends_on:
- ref('fct_daily_revenue')
- ref('dim_store_locations')

2. The Four Exposure Types​

When defining an exposure, dbt requires you to specify a type. There are exactly four valid types supported by dbt:

  1. dashboard: Used for BI tools like Tableau, PowerBI, Looker, or Metabase. This is the most common exposure type.
  2. notebook: Used for data science exploration (e.g., Jupyter, Hex, Deepnote). If a Data Scientist has a notebook that trains an ML model directly off your fct_sales table, document it here.
  3. application: Used for operational tools or custom software. For example, if your internal Customer Support app (written in React) queries a Snowflake table to display a customer's order history.
  4. ml: Used specifically for automated Machine Learning pipelines or feature stores (e.g., a SageMaker pipeline that runs nightly).

Note: The type is strictly for categorization in the dbt Docs UI. It does not change how dbt compiles the code.

3. Viewing Exposures in dbt Docs​

The magic of Exposures is realized when you run dbt docs generate and open the generated website.

  1. The Lineage Graph: When you view the DAG for fct_daily_revenue, you will see a new node at the very far right edge. It represents the daily_revenue_dashboard exposure. It is color-coded differently (usually orange) to indicate it is an external asset.
  2. The Metadata: If a developer clicks on the Exposure node, they see a beautiful summary page containing the Tableau URL, Priya's email address, and the exact business description.

If Arjun, a Data Engineer, is assigned a Jira ticket to refactor fct_daily_revenue, he can look at the DAG, immediately see that the CEO's dashboard depends on it, and email Priya to warn her about the upcoming changes!

Summary​

  • Exposures document downstream data consumers that exist outside of dbt.
  • They are defined in YAML using the exposures: key.
  • The four supported types are: dashboard, notebook, application, and ml.
  • Exposures require an owner and a list of depends_on refs.
  • They automatically render on the far right side of the dbt Docs Lineage Graph, bridging the gap between Data Engineering and Business Analytics.