01. Exposures and Lineage
Exposures and Lineage in dbt
Exposures in dbt track how models are consumed in downstream applications, dashboards, or reports.
Lineage shows the dependencies between models, sources, and tests, enabling better understanding of the data flow.
What are Exposures?
- Represent downstream consumers of your data models
- Examples:
- BI dashboards (Tableau, Looker, Power BI)
- ML models consuming transformed tables
- Reports generated by analysts
- Helps teams assess impact before making changes
YAML Example:
version: 2
exposures:
- name: sales_dashboard
type: dashboard
url: https://looker.example.com/dashboards/123
depends_on:
- ref('orders')
- ref('customers')
depends_on→ Lists models this exposure relies on
What is Lineage?
- Visual representation of model dependencies
- Shows how sources flow into intermediate models and final outputs
- Helps identify:
- Impact of changes
- Bottlenecks in data pipelines
- Opportunities for optimization
Example CLI command:
dbt docs generate
dbt docs serve
- Generates interactive lineage graph in dbt docs
- Enables tracing from source to dashboard
Best Practices for Exposures and Lineage
Define all critical exposures in YAML for visibility
Keep lineage up to date as models evolve
Use lineage to plan schema changes safely
Integrate with CI/CD to validate exposure impacts
Monitor downstream usage before making transformations