Skip to main content

dbt Lineage

Visualize your dbt model DAG with interactive upstream/downstream highlighting.

Highlight:allauthmigrationprefectdbt
User BrowserAzure ADStreamlit UIMigration EngineParquet ModeSling ModePostgreSQLAzure SQLPrefect Clouddbt Cloud

Page Overview

dbt Lineage

Visualize dbt model DAG with interactive graph and filtering options

Screenshot of dbt Lineage

How to Use

1Select a layer filter (staging, intermediate, mart)
2Browse or search for specific models
3Click a model to highlight its lineage
4View upstream dependencies and downstream consumers

Features

🔗

DAG Visualization

Interactive graph showing model relationships

🎨

Layer Colors

Color-coded by layer type for easy identification

🔍

Model Search

Find specific models by name

⬆️

Lineage Tracing

Highlight upstream and downstream dependencies

Layer Organization

dbt models are organized into layers, each with its own color:

LayerColorDescription
StagingstagingRaw data transformations
IntermediateintermediateBusiness logic layers
MartmartFinal analytical models
OtherotherUncategorized models

DAG Navigation

Filtering by Layer

Use the layer selector to focus on specific model types:

  • All - Show entire DAG
  • Staging - Only staging models (stg_*)
  • Intermediate - Only intermediate models (int_*)
  • Mart - Only mart models (fct_*, dim_*)

Selecting Models

Click a model node to:

  1. Highlight upstream - Show all models this one depends on
  2. Highlight downstream - Show all models that depend on this one
  3. View details - Model name, layer, materialization

Use the search box to find models:

  • Type part of a model name
  • Results update as you type
  • Click a result to center on that model

Model Details

When you select a model, the sidebar shows:

PropertyExample
Namefct_waste_collections
LayerMart
MaterializationTable
Upstream Count3 models
Downstream Count5 models

dbt Cloud Integration

Lineage data is fetched from dbt Cloud. Configure access with:

# Option 1: Environment variables
DBT_CLOUD_ACCOUNT_ID=12345
DBT_CLOUD_API_KEY=dbtc_xxxxxxxxxxxx
DBT_CLOUD_JOB_ID=67890

# Option 2: ~/.dbt/dbt_cloud.yml
account_id: 12345
api_key: dbtc_xxxxxxxxxxxx
job_id: 67890
Data Freshness

Lineage data is cached for 10 minutes. Click Refresh to fetch the latest manifest from dbt Cloud.

Understanding the DAG

Upstream Dependencies

Models shown above and to the left of your selected model. These are the inputs required to build your model.

stg_customers → int_customer_orders → fct_orders

upstream selected

Downstream Consumers

Models shown below and to the right. These models depend on your selected model.

fct_orders → rpt_daily_orders
↑ ↑
selected downstream

Troubleshooting

"dbt Cloud not configured"

  1. Set DBT_CLOUD_ACCOUNT_ID and DBT_CLOUD_API_KEY
  2. Or create ~/.dbt/dbt_cloud.yml with credentials
  3. Ensure the job has run at least once to generate a manifest

"No models found"

  1. Verify the job ID is correct
  2. Check that the dbt job has completed successfully
  3. Ensure the manifest artifact is available

Graph not rendering

  1. Install the streamlit-agraph package
  2. Check browser console for JavaScript errors
  3. Try refreshing the page