dbt Column-Level Lineage: The Foundation for Safe Schema Changes

  • Datameer, Inc.
  • November 30, 2026
dbt Column-Level Lineage banner

TL;DR

  • dbt column-level lineage records which input columns feed each output column, so you can see what a rename or type change will break before you merge it.
  • dbt's own docs graph shows lineage between models, and column-level views in dbt Catalog sit on its paid Enterprise plans.
  • You can build column lineage for any dbt project from manifest.json and catalog.json with about 50 lines of Python and the open-source sqlglot parser.
  • Parsed lineage follows the columns a query selects. It misses columns used only in WHERE filters and JOIN keys, plus any reader outside the dbt project.
  • A pull request check that combines column lineage across platforms with runtime metrics closes most of those gaps before a change ships.

Every dbt project eventually renames a column. The model compiles, dbt build passes, and the pull request looks small. A day later a revenue dashboard drops a region, and someone spends an afternoon tracing which field moved.

dbt already tracks how models depend on each other, but a broken report almost always traces back to one specific column. This guide explains how dbt column-level lineage works, builds it from your own project with a script we ran end to end, and shows where parsed lineage stops. By the end, you will know how to check a schema change at column level before it merges, and what still needs a check beyond the dbt project.

What Is Column-Level Lineage in a dbt Project?

Data lineage is the record of where data comes from and where it goes. dbt builds it from the ref() and source() calls in each model, so it knows which models feed which. That is table-level lineage: one model connected to another as a whole.

Column-level lineage goes one step further and connects individual fields. Suppose we have a data team at a B2B SaaS company running dbt. A staging model called stg_subscriptions holds price_cents and seats, a mart called fct_mrr turns them into mrr_usd, and a model called mrr_by_region sums that into total_mrr_usd for the board report.

Table-level lineage says mrr_by_region depends on fct_mrr, which depends on stg_subscriptions. Column-level lineage says total_mrr_usd is built from mrr_usd, which is built from price_cents and seats. For the SaaS team, that is the difference between knowing two models are related and knowing which board number moves when one field changes.

Why Do Schema Changes Break Things That dbt Tests Miss?

dbt tests check the data inside a model, such as a column that should never be null or a key that should be unique. They do not check what reads that column. A rename can pass every test in the model that changed and still break the models, dashboards and syncs downstream of it.

The volume of these changes is growing as AI writes more pipeline code. According to dbt Labs' 2026 State of Analytics Engineering Report, 72% of data teams now prioritize AI-assisted coding, while only 24% prioritize AI-assisted pipeline management such as testing and observability. The same survey of 363 practitioners found that prioritizing trust in data rose from 66% to 83% in one year.

Review time is where the pressure lands. Faros AI's Acceleration Whiplash report, based on telemetry from 22,000 developers, found median pull request review time five times higher on teams with high AI adoption. Column-level lineage answers the reviewer's first question for them: what reads this field?

We covered how agents change pipeline code in our guide to agentic data pipelines. The rest of this guide focuses on the lineage check those changes need.

How Does dbt Store the Inputs for Column Lineage?

dbt writes two files that hold everything a lineage parser needs. You produce both with two commands:

dbt build
dbt docs generate
  • target/manifest.json holds every node in the project, with its compiled_code, its depends_on list and its relation_name. The compiled SQL is the key input, because Jinja and macros are already resolved in it.
  • target/catalog.json holds the columns and data types of every table and view as they exist in the warehouse. A parser needs this schema to resolve unqualified columns and select *.
Four steps from dbt artifacts to column edges: read manifest.json and catalog.json, parse compiled SQL with sqlglot lineage(), record input column to output column edges, then ask what reads a column with downstream()

How the script below turns dbt's two artifact files into column edges you can query

Neither file stores column-to-column edges in dbt Core. That step needs a SQL parser that reads each compiled query and works out which input columns feed each output column.

How to Build Column-Level Lineage From a dbt Project in Python

The script below uses sqlglot, an open-source SQL parser with a built-in lineage() function. We ran it against the SaaS project with dbt Core 1.12, the dbt-duckdb adapter and sqlglot 30.22. Swap dialect="duckdb" for snowflake, bigquery or your own warehouse.

import json
from collections import defaultdict

from sqlglot import exp
from sqlglot.lineage import lineage

manifest = json.load(open("target/manifest.json"))
catalog = json.load(open("target/catalog.json"))

# 1. Build a schema map from catalog.json: database -> schema -> table -> {column: type}
schema = {}
relation_to_node = {}
for unique_id, node in {**catalog["nodes"], **catalog["sources"]}.items():
    meta = node["metadata"]
    columns = {name: col["type"] for name, col in node["columns"].items()}
    schema.setdefault(meta["database"], {}).setdefault(meta["schema"], {})[meta["name"]] = columns
    relation_to_node[(meta["database"].lower(), meta["schema"].lower(), meta["name"].lower())] = unique_id


def node_for(table: exp.Table) -> str:
    key = (table.catalog.lower(), table.db.lower(), table.name.lower())
    return relation_to_node.get(key, table.sql())


# 2. Parse each model's compiled SQL and record one edge per input column
edges = []  # (upstream_node, upstream_column, model, output_column)
for unique_id, node in manifest["nodes"].items():
    if node["resource_type"] != "model":
        continue
    sql = node["compiled_code"]
    for column in catalog["nodes"][unique_id]["columns"]:
        root = lineage(column, sql, schema=schema, dialect="duckdb")
        for step in root.walk():
            if isinstance(step.source, exp.Table) and not step.downstream:
                upstream_column = step.name.split(".")[-1]
                edges.append((node_for(step.source), upstream_column, unique_id, column))

# 3. Index the edges so we can ask "what reads this column?"
readers = defaultdict(set)
for up_node, up_col, down_node, down_col in edges:
    readers[(up_node, up_col)].add((down_node, down_col))


def downstream(node: str, column: str, depth: int = 1):
    for reader in sorted(readers[(node, column)]):
        print("  " * depth + f"{reader[0]}.{reader[1]}")
        downstream(*reader, depth + 1)


if __name__ == "__main__":
    print(f"{len(edges)} column edges found\n")
    print("model.saas.stg_subscriptions.price_cents")
    downstream("model.saas.stg_subscriptions", "price_cents")

The script works in three steps:

  1. Schema map: it reads every table and view in catalog.json and builds the nested schema dictionary that sqlglot expects.
  2. Edges: for each model, it traces every output column back to the warehouse tables it came from. Each traced input becomes one edge.
  3. Reverse index: it flips the edges into a readers map, so you can ask which columns read a given column.

Saved as column_lineage.py and run from the project root, it prints this for the SaaS project:

16 column edges found

model.saas.stg_subscriptions.price_cents
  model.saas.fct_mrr.mrr_usd
    model.saas.mrr_by_region.total_mrr_usd

How to Check a Column Rename Before You Merge It

The output above is the rename check. Before renaming price_cents, the SaaS team can see that fct_mrr.mrr_usd reads it directly and mrr_by_region.total_mrr_usd reads it two hops away. Both models need an update in the same pull request, or the board report breaks.

To make this a habit, run the same steps on every pull request that touches a model:

  1. Run dbt build and dbt docs generate on the branch, so both artifact files reflect the change.
  2. List the columns the pull request renames, retypes or removes.
  3. Call downstream() for each one and post the result as a pull request comment.
  4. Block the merge when a listed reader still selects the old name.

This catches renames and type changes that flow through SELECT lists across the whole dbt project. For a longer view of what dbt's native graph misses at the model level, see our guide to dbt lineage limitations.

Where Does Parsed Column Lineage Stop?

Parsed lineage follows the columns a query selects, and that leaves real gaps. Our script found 16 edges in the SaaS project, but it found no reader at all for two columns that fct_mrr depends on.

fct_mrr joins on account_id and filters with where s.is_active. Neither column appears in its output, so neither produces an edge:

from column_lineage import readers

print(readers[("model.saas.stg_subscriptions", "is_active")])

set()

Renaming is_active would break fct_mrr on the next run, and the lineage graph would show nothing that reads it. The gap is easy to miss because the graph still looks complete.

Where parsed column lineage stops: price_cents and seats are selected into fct_mrr.mrr_usd and found, while the is_active filter, the account_id join key and readers outside dbt such as a board dashboard and a CRM sync are not in the parsed graph

Projection edges the parser finds, next to the filter, join and outside readers it misses

The other gaps come from where the parser looks:

  • Readers outside the dbt project. A Looker or Tableau dashboard, a reverse-ETL sync or a notebook can query fct_mrr directly. None of them appear in manifest.json.
  • Edges the parser cannot resolve. Dynamic SQL, unusual dialect syntax or a missing table in catalog.json can leave a column untraced. The script above drops these quietly, so a reviewer cannot tell a missing edge from a column with no readers.
  • Runtime behavior. A change can keep every column intact and still make a model scan far more data or return twice the rows. Lineage alone will not show that cost.

How Datameer Extends Column Lineage Past the dbt Project

Datameer builds the same kind of column-level lineage, but across the platforms in an estate instead of one dbt project. It derives column edges by parsing each job's SQL with no manual curation, and it reads OpenLineage-emitting systems, Snowflake and other non-dbt sources. Any edge it had to infer from name matching is marked inferred, so a reviewer can tell a parsed edge from a guess.

That answers three of the gaps above:

  • Readers outside dbt: the graph follows fct_mrr out of the warehouse into BI extracts, reverse-ETL syncs and notebooks.
  • Silent gaps: systems Datameer has not mapped yet show up as unmapped instead of being left out.
  • Runtime cost: the impact report compares duration, result rows, result bytes, bytes scanned and records read between two versions of the same job.
Datameer column-level lineage page showing stg_orders.order_total traced across Snowflake tables, a SQL model and other systems, with parsed and inferred edges and three downstream columns

Datameer column-level lineage page

All of this lands where the rename check from earlier lives: a comment on the GitHub pull request, before merge. Datameer is read-only outside its pull request comments, so it reports what a change will break without changing any data or code. The pull request flow supports GitHub today.

How to Roll Column Lineage Into Your Review Process

Start small and widen the check as it proves useful. Most teams move through three stages:

  1. Run the script by hand before risky renames, using the version in this guide. It takes a few seconds on a small project.
  2. Add it to CI on pull requests that touch models/, and post the downstream() output as a comment. Add a manual check for filter and join columns, since the script will not flag them.
  3. Extend past dbt once breakages start landing in dashboards, syncs or notebooks. That is where a cross-platform graph with runtime metrics pays for itself.

If your team runs dbt on Snowflake with BI tools and syncs reading from it, stage three usually comes sooner than expected. Datameer's column-level lineage handles that cross-platform step.

Where Should You Start

Column-level lineage turns a schema change from a guess into a list of named readers. dbt's artifact files already hold everything a parser needs, and the script in this guide builds that list for a small project in seconds. Its limits are clear too: filter and join columns, readers outside dbt and runtime cost all need a check beyond parsed SELECT lists.

Run the script on your own project today and look for the next column you plan to rename. If its readers reach past dbt into dashboards, syncs or notebooks, see how Datameer's PR impact analysis reports them on the pull request, and join the waitlist to try it on your estate.

FAQs

Does dbt Core Include Column-Level Lineage?

No. dbt Core records lineage between models through ref() and source(), and its docs site shows that model-level graph. Column-level lineage needs a SQL parser, such as the sqlglot script in this guide, or a tool that runs one for you.

Do I Need catalog.json to Build Column Lineage?

Yes, for accurate results. catalog.json gives the parser each table's columns and types, which it needs to resolve unqualified columns and expand select *. Without it, many columns stay untraced. Run dbt docs generate after dbt build to produce it.

Why Does My Column Lineage Miss Columns Used in Joins or Filters?

Parsers like sqlglot trace the columns a query selects into its output. A column used only in a JOIN condition or a WHERE filter changes which rows come out, but it never becomes an output column, so no edge is recorded. Check those columns by hand or with a tool that tracks them.

Can Column-Level Lineage Run on Every Pull Request?

Yes. Build the branch, generate both artifact files, run the lineage script for the changed columns and post the result as a comment. Datameer runs this kind of check on GitHub pull requests and adds runtime metrics for each version of the job.

How Is Column-Level Lineage Different From Data Diffing?

Column-level lineage tells you which fields depend on which, so you know what a change could affect. Data diffing compares the actual rows of two versions of a table to see what changed in the values. They answer different questions about the same change.