Skip to content

Data lineage is the record of where a piece of data came from, what was done to it on the way, and what depends on it. Table-level lineage keeps that record between whole tables: this model is built from those two. Column-level lineage keeps it between individual columns: this revenue column is calculated from that amount column. An analytics engineer uses lineage to see what a change will break before making it, to trace a wrong number back to its source, and to find out who consumes a model.

Table-level and column-level lineage

Lineage is usually drawn as a directed acyclic graph (DAG): nodes joined by arrows that never loop back. Each arrow means "is built from". Everything a node is built from is upstream of it. Everything built from it is downstream. The two levels differ in what a node is.

  • Table-level lineage has one node per table, view, or dashboard. It says that fct_orders is built from stg_orders and stg_customers, but not which of their columns it uses.
  • Column-level lineage has one node per column. It says which upstream columns a column is copied, renamed, or calculated from, so a change to one column can be told apart from a change to the whole table.

What analytics engineers use lineage for

  • Impact analysis before a change. Before you rename a column, change a join, or drop a model, list everything downstream of it. Those are the models and dashboards that can break.
  • Tracing a wrong number to its source. When a dashboard figure looks wrong, walk upstream one node at a time and check each one until you reach the first node where the data is wrong. A failing data test upstream is a good place to start.
  • Knowing who consumes a model. A model with nothing downstream is either unused or feeds something the graph does not know about. Lineage answers this only for consumers that have been declared.

How dbt builds the lineage graph

dbt builds tables and views from SQL SELECT statements called models. It reads lineage from two functions in the model code: ref('model_name') names another model, and source('source_name', 'table_name') names a raw table declared in YAML. The dbt documentation says each one compiles to the full object name in the database and creates a dependency between that node and the current model. Those dependencies are the DAG, and dbt uses the same graph to run models in the right order.

The examples below come from a four-model project run with dbt v1 (dbt-core 1.12.7) on PostgreSQL 16. Two staging models select from sources, and fct_orders joins them:

select
    o.order_id,
    c.customer_name,
    o.amount,
    o.ordered_on
from {{ ref('stg_orders') }} as o
join {{ ref('stg_customers') }} as c
    on c.customer_id = o.customer_id

A fourth model, customer_revenue, sums amount per customer from fct_orders.

Exposures: lineage past the last model

A dashboard is not a model, so dbt cannot see it until you declare it. An exposure is a YAML entry that describes a downstream use of the project, such as a dashboard, a notebook, or an application. A name, a type, and an owner are required:

exposures:
  - name: weekly_revenue
    type: dashboard
    owner:
      name: Finance Analytics
    depends_on:
      - ref('customer_revenue')

Listing upstream and downstream nodes

dbt's node selection syntax has graph operators. A plus sign before a name selects the node and all of its ancestors. A plus sign after it selects the node and all of its descendants. dbt ls lists what a selection matches without connecting to the database. Upstream of fct_orders:

$ dbt ls --select "+fct_orders"
shop.fct_orders
shop.stg_customers
shop.stg_orders
source:shop.app.customers
source:shop.app.orders

Downstream of stg_orders, which is the impact list for a change to that model:

$ dbt ls --select "stg_orders+"
exposure:shop.weekly_revenue
shop.customer_revenue
shop.fct_orders
shop.stg_orders

The exposure is on the list, so its owner is someone to tell before the change. A number limits the distance: stg_orders+1 returned only stg_orders and fct_orders. In the other direction, the raw tables behind a dashboard:

$ dbt ls --select "+exposure:weekly_revenue" --resource-type source
source:shop.app.customers
source:shop.app.orders

Which lineage answers which question

QuestionKind of lineageWhere to look in dbt
What can break if I change this model?Table-level, downstreamdbt ls --select "model_name+", or the lineage graph
What is this model built from?Table-level, upstreamdbt ls --select "+model_name"
Which dashboards use this model?Table-level, downstream as far as exposuresExposures in the downstream list or in the lineage graph
Which raw tables feed this dashboard?Table-level, upstream from an exposuredbt ls --select "+exposure:name" --resource-type source
Can I rename or drop this one column?Column-level, downstreamColumn-level lineage, where you have it (see below)
Where is this column's value calculated?Column-level, upstreamColumn-level lineage, or the SQL of each upstream model

Where to see the lineage graph in dbt

  • dbt Docs (Legacy). dbt v1, the original Python-based version, generates a static documentation site. A model's page opens a small graph of its direct parents and children, which expands to the full lineage and accepts the same --select syntax.
  • dbt Docs v2. The site generated locally by dbt v2, the current Rust-based version.
  • Catalog. On the dbt platform's Starter, Enterprise, and Enterprise+ plans, Catalog shows an interactive lineage graph that is refreshed by job runs in the production or staging environment. Exposures appear in it as nodes.

Column-level lineage in dbt

The documentation lists two places: Catalog on Enterprise and Enterprise+ plans, and dbt v2 run locally with strict static analysis turned on (in the dbt VS Code extension, dbt Docs v2, and the command line). Neither was run for this article. The documented limits in Catalog: it follows the select statements in model SQL and does not reflect joins and filters, it depends on parsing the SQL and can be incomplete, and it cannot be worked out through Python models.

Where dbt's lineage stops

  • Hard-coded table names. dbt only knows the edges that ref and source create. In the test project, a fifth model that named analytics.fct_orders directly was missing from dbt ls --select "fct_orders+", and dbt built it before the model it reads from.
  • Everything outside the project. The graph starts at declared sources and ends at declared exposures. The loading jobs before and the undeclared reports after are not in it.

For lineage across tools there is OpenLineage. Its documentation describes an open standard for collecting lineage metadata about jobs as they run, with a core model of datasets, jobs, and runs, and lists integrations for several systems, including dbt. For tools that display lineage from many systems, see automated data catalogs.

Frequently Asked Questions

What is the difference between table-level and column-level lineage?

Table-level lineage records which tables, views, and dashboards are built from which others. Column-level lineage records which upstream columns each column is built from. The first finds everything a change might affect. The second narrows that to what uses the column you are changing.

Can you give an example of a data lineage diagram and explain its components?

For the project above, the diagram reads from left to right: the two sources, the two staging models, fct_orders, customer_revenue, and the weekly_revenue dashboard. Each box is a node and each arrow is a dependency. In dbt's lineage graph, upstream nodes are to the left of the selected model and downstream nodes are to the right.

Does dbt create data lineage automatically?

For models, yes, provided every model reaches other tables through ref and source. Dashboards and other uses outside the project have to be declared as exposures. The documentation says dbt can also create them automatically for supported integrations, and that those appear in Catalog.

What are the best practices for creating data lineage documentation?

This site's advice: let the code produce the lineage, because a hand-drawn diagram is out of date after the next merge. Use ref or source for every table a model reads, declare an exposure with an owner for each dashboard people rely on, and describe models and columns. See best practices for data documentation.

Primary sources and further reading

Sources were read in November 2026, and product names follow them.