Skip to main content

DBT Column Lineage

Tests PyPI Downloads Python Version License

📖 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

DBT Column Lineage Demo - Concept

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:

  1. Select a model and column from the sidebar to visualize its lineage
  2. Click "Analyze Impact" to see which models, transformations, and exposures will be affected if you change that column
  3. 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.json doesn't embed compiled_code (e.g. produced by dbt parse), as long as target/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), or any.
  • 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, or json.

For the impact subcommand:

  • --base-manifest / --base-catalog: base-branch artifacts for the two-manifest diff.
  • --git-base: git ref to diff changed .sql files against (git-diff fallback).
  • --scope-git: with a two-manifest diff, restrict the report to models changed in git 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-on severity gate as an exit code.
  • --fail-on: gate policy — none (default), exposures, critical, or any.
  • --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

dbt_col_lineage-0.12.0.tar.gz (199.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbt_col_lineage-0.12.0-py3-none-any.whl (216.8 kB view details)

Uploaded Python 3

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

Hashes for dbt_col_lineage-0.12.0.tar.gz
Algorithm Hash digest
SHA256 310bdf528e55f5bd45ae140cbfb7bc06b60bf2fd170c0f852da1a7b945af0a95
MD5 96da2451214f09f6ad6d6871503c33f6
BLAKE2b-256 254accfcf773ebcb582bc89a07e2970e856c346ea35d8ba95537eda2c6bab55d

See more details on using hashes here.

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

Hashes for dbt_col_lineage-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02a0f344978fdf29f80b3b9781c41cea3d8e41616d98e24a7b19b5a9441d367d
MD5 abbeb39dbac114da51449e64633afa71
BLAKE2b-256 ba74eb5ca1fc0bea7662c12732af3ecf31094aaf7dbbe4c8d941110bf452be26

See more details on using hashes here.

Release history Release notifications | RSS feed

0.16.1

2 files

0.16.0

2 files

0.15.0

2 files

0.14.0

2 files

0.13.0

2 files

This release

0.12.0 This release

2 files

0.11.0

2 files

0.10.0

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page