04. Lineage and Exposures
️ What is Lineage in dbt?
Lineage in dbt refers to how your models are connected – which sources feed into which models, and how transformations flow from raw data → intermediate models → final tables.
dbt automatically builds a Directed Acyclic Graph (DAG) that represents these dependencies.
Why is Lineage Important?
Helps visualize the data flow
Identifies upstream and downstream dependencies
Makes impact analysis easier before making changes
Improves collaboration between teams
How to View Lineage in dbt?
- After running
dbt docs generateanddbt docs serve, you’ll see an interactive DAG. - Each node represents:
- Sources (blue)
- Models (green)
- Tests (orange)
- Seeds (purple)
Example DAG:
raw\_orders → stg\_orders → fct\_orders → sales\_dashboard
What are Exposures in dbt?
Exposures let you document downstream consumers of your data, such as:
- Dashboards (Looker, Power BI, Tableau)
- Reports
- Machine Learning models
This provides visibility into who relies on your data.
Example Exposure in schema.yml
exposures:
- name: sales_dashboard
type: dashboard
maturity: high
url: "https://looker.example.com/dashboards/123"
description: "Main sales performance dashboard"
depends_on:
- ref('fct_orders')
Benefits of Using Exposures
Improves data governance Makes impact analysis for BI tools easier Links business usage to dbt models
Commands to Validate Exposures
Run:
dbt run
dbt docs generate
dbt docs serve
Your Exposures will appear as pink nodes in the DAG.