Skip to main content

Visualize column-level lineage of dbt models in the browser, parsed from manifest.json/catalog.json with sqlglot

Reason this release was yanked:

yan

Project description

dbt-column-lineage

This is a tool to visualize the column level lineage of dbt models. It uses the manifest.json and catalog.json files generated by dbt to create a graph of the lineage of the models. It is a web application that uses a FastAPI backend and a Next.js frontend.

CI PyPI - Version PyPI - Python Version PyPI - Downloads PyPI - License

Demo

Trace a column across models, then expand more columns to grow the lineage interactively:

column-level lineage demo

The demo runs on the synthetic dbt project under demo/ (no warehouse required). Regenerate its manifest.json/catalog.json with python demo/build_demo_manifest.py.

There's also an edit / design mode (pencil button, bottom-right): edit existing models or sketch new ones — name, columns, and materialization type (table/view/incremental/snapshot/seed) — then share the design as a URL or export it as JSON.

quickstart

Install dbt-column-lineage using pip:

pip install dbt-column-lineage

Run the following command:

# go to your dbt project directory
cd your-dbt-project/

# edit your model file
vi models/test.sql

# generate the manifest.json and catalog.json files
dbt docs generate 

# set the environment variable for the dialect you are using
export SQLGLOT_DIALECT=snowflake

# Launch dbt-column-lineage with test.sql as the initial model
dbt-column-lineage run-params

development

To develop the application, you will need to run the backend and frontend separately.

git clone git@github.com:tomoki-takahashi-oisix/dbt-column-lineage.git
cd dbt-column-lineage

for backend

activate venv and run the following commands:

python3 -m venv venv
source venv/bin/activate

pip install --upgrade pip
pip install -r requirements.txt

uvicorn --app-dir src dbt_column_lineage.main:app --port=5000 --reload

for frontend

run the following commands:

npm install
npm run dev

after the frontend is running, Let's access http://localhost:3000

for Looker integration (optional)

If you want to integrate with Looker, you can use the following commands:

# set the environment variables
export LOOKERSDK_CLIENT_ID=(your client id)
export LOOKERSDK_CLIENT_SECRET=(your client secret)
export LOOKERSDK_BASE_URL=(your looker base url)
export LOOKER_IGNORE_FOLDERS=(comma separated list of folders to ignore)
export LOOKER_IGNORE_ELEMENTS=(comma separated list of dashboard elements to ignore)

# it analyzes the looker models; target/looker_analysis.json will be created
python tools/looker_analyzer.py

# rerun the backend
uvicorn --app-dir src dbt_column_lineage.main:app --port=5000 --reload

for Google OAuth login test (optional)

If you want to test the OAuth login, you can use the following commands:

export GOOGLE_CLIENT_ID=(your client id)
export GOOGLE_CLIENT_SECRET=(your client secret)
# fixed session signing key (see note below)
export SESSION_SECRET=$(python3 -c "import secrets; print(secrets.token_hex(32))")
docker build -t test .
docker run -p 5000:5000 -e USE_OAUTH=true -e GOOGLE_CLIENT_ID=$GOOGLE_CLIENT_ID -e GOOGLE_CLIENT_SECRET=$GOOGLE_CLIENT_SECRET -e SESSION_SECRET=$SESSION_SECRET -e DEBUG_MODE=true test

SESSION_SECRET — The container runs uvicorn --workers 2 (multiple processes), and a deployment may also scale out to multiple instances. Sessions are stored in a signed cookie, so every process must share the same signing key. With USE_OAUTH=true, set a fixed SESSION_SECRET (any stable random string) or sign-in breaks across workers (login loops / API 401). If unset, each process generates its own random key (fine only for a single process). Without OAuth it is not needed.

limiting heavy lineage queries (optional)

For very large projects a single request — e.g. reverse lineage of a hub column consumed by many models — can take a long time. Set MAX_LINEAGE_SECONDS to a wall-clock budget (seconds); when traversal exceeds it, the server stops and returns the partial result flagged truncated (the UI shows a banner) instead of hanging. Default -1 = unbounded. In a hosted deployment set it below your gateway's request timeout so you get 200 + truncated rather than a gateway timeout.

# example: cap lineage traversal at 100 seconds
export MAX_LINEAGE_SECONDS=100

Project 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_column_lineage-0.6.1.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

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

dbt_column_lineage-0.6.1-py3-none-any.whl (1.0 MB view details)

Uploaded Python 3

File details

Details for the file dbt_column_lineage-0.6.1.tar.gz.

File metadata

  • Download URL: dbt_column_lineage-0.6.1.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for dbt_column_lineage-0.6.1.tar.gz
Algorithm Hash digest
SHA256 c662aeb4133dbc01f541935473db45e6062b19312fb46b8cf78393d15887f7a3
MD5 f9e8e2c886e8965a47144d7354e5471e
BLAKE2b-256 1a3fa087237ff46b8cf8a258c3cc85a599365a2ea53da86f1c522980c4060f0f

See more details on using hashes here.

File details

Details for the file dbt_column_lineage-0.6.1-py3-none-any.whl.

File metadata

File hashes

Hashes for dbt_column_lineage-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5eab4b53597718e5a77cdb21dbca49f41eb4766e59b5db2185b420c13f5fb270
MD5 80043295305cd21c7ba6e6123db3108e
BLAKE2b-256 58f1923a37cbeb403a3905f520899112627b09d7378d070134aea02732dfc8c4

See more details on using hashes here.

Supported by

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