DBT Column Lineage
📖 Documentation | 🚀 Live Demo | 🐛 Report Bug | 💡 Request Feature
Overview
Understand the impact of column changes before you make them. DBT Column Lineage provides impact analysis & column lineage to help you answer critical questions: What happens if I change this column? Which models, transformations, and exposures will be affected? Does it use complex business logic, or is this column only projected?
The core idea behind this project: be more comfortable when making changes on a large project by knowing the impact.
Key Features:
- Impact Analysis: Understand downstream effects of column changes, including affected models, transformations, and exposures
- Interactive Explorer: A local web server with an intuitive UI to explore model and column lineage visually, including associated transformations
Installation
pip install dbt-col-lineage
Usage
First, ensure your dbt project is compiled and you have generated the catalog:
dbt compile
dbt docs generate
Interactive Explorer
Start the interactive web interface to explore lineage and perform impact analysis:
dbt-col-lineage --explore \
--manifest path/to/manifest.json \
--catalog path/to/catalog.json \
--port 8080 # Optional port selection
This starts a server (defaulting to port 8000). Open your web browser to the specified address (e.g., http://127.0.0.1:8080).
Workflow:
- Select a model and column from the sidebar to visualize its lineage
- Click "Analyze Impact" to see which models, transformations, and exposures will be affected if you change that column
- Review the impact analysis panel showing:
- Columns that require review (with transformations that may break)
- Pass-through columns (direct references)
- Affected models in the dependency chain
- Affected exposures
Machine-readable output (AI / automation)
Emit column lineage and downstream impact analysis as a single JSON document — ideal for feeding AI agents, CI checks, or other tooling:
dbt-col-lineage --select stg_accounts.account_id --format json \
--manifest path/to/manifest.json --catalog path/to/catalog.json
The document contains the column's upstream and downstream lineage (each split
into models, sources, direct_refs, exposures) and, when downstream lineage
is requested, an impact block summarising affected models, columns and exposures.
Note: the tool works even when your
manifest.jsondoesn't embedcompiled_code(e.g. produced bydbt parse), as long astarget/compiled/**exists — it falls back to the compiled SQL on disk.
Diff-driven impact (impact)
The unit of work in a PR is a set of changed columns, not a single one. The
impact command derives that changeset and reports one consolidated blast radius.
Two-manifest diff (the reliable, dbt-native signal — compares the base branch's artifacts against the current ones for added / removed / retyped columns and changed compiled SQL):
dbt-col-lineage impact \
--manifest target/manifest.json --catalog target/catalog.json \
--base-manifest base/manifest.json --base-catalog base/catalog.json
Git-diff fallback (when only one manifest is available — diffs changed .sql
model files against a git ref and treats touched models as logic changes):
dbt-col-lineage impact --git-base main
Output defaults to a human-readable Markdown summary (exposures first, then a
blast-radius table). Use --format json for a machine-readable report — a
superset of the single-column impact block plus a top-level changeset and a
per-change by_change breakdown.
CI check + PR comment (impact --ci)
--ci turns the report into a pull-request check: it posts a sticky Markdown
comment (found-or-updated by a hidden marker, so re-runs edit one comment
instead of spamming the thread) and applies a severity gate as the process
exit code.
dbt-col-lineage impact --ci \
--manifest target/manifest.json --catalog target/catalog.json \
--base-manifest base/manifest.json --base-catalog base/catalog.json \
--fail-on exposures
--fail-on: gate policy —none(default: warn only, never block),exposures(fail when a business-facing exposure is affected),critical(fail when a downstream column recomputes derived logic), orany.- The PR context (token, repo, PR number) is resolved from the standard GitHub
Actions environment (
GITHUB_TOKEN,GITHUB_REPOSITORY,GITHUB_EVENT_PATH); override with--github-token/--repo/--pr-number. When no context is available the comment is skipped and only the gate runs.
GitHub Action. A ready-to-use composite action ships in this repo. Pin the
floating major tag to get updates within a major version (the usual
convention, like actions/checkout@v4); the tool is currently 0.x, so that
tag is @v0:
- uses: Fszta/dbt-column-lineage@v0
with:
manifest: artifacts/head/manifest.json
catalog: artifacts/head/catalog.json
base-manifest: artifacts/base/manifest.json
base-catalog: artifacts/base/catalog.json
fail-on: none # start non-blocking; flip to exposures|critical once trusted
For reproducible builds, pin an exact release instead — @v0.8.0 (the same tag
as the pip package). The action installs the source bundled at whichever ref you
pin, so the CLI always matches it.
The workflow needs permissions: pull-requests: write to post the comment. A
complete example workflow (building base- and head-branch artifacts) lives at
docs/examples/impact-pr-check.yml.
Options
--explore: Starts the interactive web server for exploring lineage and impact analysis--catalog: Path to the dbt catalog file (default:target/catalog.json)--manifest: Path to the dbt manifest file (default:target/manifest.json)--port,-p: Port for the interactive web server (default:8000)--adapter: Override the SQL dialect used by the parser (sqlglot dialect name, e.g.,tsql,snowflake,bigquery). When provided, this overrides the adapter detected from the dbt manifest.--format,-f: Output format for--select:text(default),dot, orjson.
For the impact subcommand:
--base-manifest/--base-catalog: base-branch artifacts for the two-manifest diff.--git-base: git ref to diff changed.sqlfiles against (git-diff fallback).--scope-git: with a two-manifest diff, restrict the report to models changed ingit diff <ref>...HEAD— drops changes on models the branch didn't touch (useful when the base artifacts may be staler than the base ref).--ci: post a sticky PR comment and apply the--fail-onseverity gate as an exit code.--fail-on: gate policy —none(default),exposures,critical, orany.--github-token/--repo/--pr-number: override the GitHub context (defaults from the Actions env).
Limitations
- Doesn't support python models
- Some functions/syntax cannot be parsed properly, leading to models being skipped
Compatibility
The tool has been tested with the following dbt adapters:
- Snowflake
- SQLite
- DuckDB
- MS SQLServer / TSQL
License
This project is licensed under the MIT License - see the LICENSE file for details.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dbt_col_lineage-0.12.0.tar.gz.
File metadata
- Download URL: dbt_col_lineage-0.12.0.tar.gz
- Upload date:
- Size: 199.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.1.3 CPython/3.9.25 Linux/6.17.0-1022-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
310bdf528e55f5bd45ae140cbfb7bc06b60bf2fd170c0f852da1a7b945af0a95
|
|
| MD5 |
96da2451214f09f6ad6d6871503c33f6
|
|
| BLAKE2b-256 |
254accfcf773ebcb582bc89a07e2970e856c346ea35d8ba95537eda2c6bab55d
|
File details
Details for the file dbt_col_lineage-0.12.0-py3-none-any.whl.
File metadata
- Download URL: dbt_col_lineage-0.12.0-py3-none-any.whl
- Upload date:
- Size: 216.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.1.3 CPython/3.9.25 Linux/6.17.0-1022-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02a0f344978fdf29f80b3b9781c41cea3d8e41616d98e24a7b19b5a9441d367d
|
|
| MD5 |
abbeb39dbac114da51449e64633afa71
|
|
| BLAKE2b-256 |
ba74eb5ca1fc0bea7662c12732af3ecf31094aaf7dbbe4c8d941110bf452be26
|