dbt-graphify
Parse a dbt manifest.json into a graphify-queryable knowledge graph. Ask AI questions about your dbt lineage without reading hundreds of SQL files.
dbt manifest.json ──► dbt-graphify ──► graphify-out/graph.json
│
┌─────────────────────┤
▼ ▼
graphify query graph.html
"what breaks if I (interactive
change stg_orders?" D3 viewer)
Why
Graphify can't read dbt projects directly — Jinja2 SQL ({{ ref('model') }}) breaks its extractor, and it doesn't understand dbt's layer semantics (staging → intermediate → mart). The result is a noisy, incomplete graph that costs more tokens to query than just grepping the files.
dbt already computes the perfect graph in manifest.json. This tool reshapes it into the format graphify expects, with zero LLM calls.
Installation
pip install dbt-graphify
# With topology-based community detection (recommended):
pip install "dbt-graphify[clustering]"
# With YAML source description parsing:
pip install "dbt-graphify[yaml]"
# Everything:
pip install "dbt-graphify[all]"
No runtime dependencies without extras — stdlib only.
Usage
# Auto-detect manifest.json in standard dbt locations
dbt-graphify
# Explicit manifest path
dbt-graphify path/to/target/manifest.json
# Custom output directory
dbt-graphify --out /tmp/my-graph
# Skip graph.html generation
dbt-graphify --no-html
# Module form (no install required)
python -m dbt_graphify
Watch mode
Keep the graph in sync as you work. Run this in one terminal:
dbt-graphify --watch # auto-detect manifest
dbt-graphify . --watch # explicit directory
dbt-graphify path/to/target/manifest.json --watch # specific file
In another terminal, run dbt as usual:
dbt compile # or dbt run, dbt build, dbt parse
Every time dbt regenerates manifest.json, the graph rebuilds automatically — no manual re-runs. Press Ctrl-C to stop watching.
The graph depends entirely on manifest.json (a dbt artifact, typically gitignored), not on source file commits, so watch mode is the right way to keep it current during active development.
Fallback: no compiled manifest
If manifest.json is empty (dbt not compiled), the tool falls back to graph_summary.json, which dbt writes even during dbt parse:
cd your-dbt-project/
dbt parse # fast, no DB connection needed
dbt-graphify # auto-finds target/graph_summary.json
Output
All files written to graphify-out/ (or --out dir):
| File | Description |
|---|---|
graph.json |
NetworkX node-link graph — loaded by graphify query |
lineage.json |
Full ancestor/descendant maps for blast-radius analysis |
GRAPH_REPORT.md |
Human-readable architecture summary with blast-radius table |
.graphify_root |
Project root path (read by graphify for incremental updates) |
.graphify_labels.json |
Community integer → label name mapping |
graph.html |
Interactive D3 visualization (generated via graphify cluster-only) |
Querying with graphify
After running dbt-graphify, use graphify to query the graph:
graphify query "which models depend on stg_customers?"
graphify query "trace the full lineage of orders_mart"
graphify query "what breaks if I change stg_payments?"
graphify path "raw_orders" "revenue_report"
graphify explain "int_order_metrics"
Claude Code integration
Install the graphify skill and run /dbt-graphify to regenerate the graph, then use /graphify query for any lineage question:
graphify install claude # installs the graphify skill + hook
After that, any graphify query or graphify path command in Claude Code will use the knowledge graph instead of reading raw SQL files — typically 70–90% fewer tokens per question.
Node structure
Each node in graph.json carries these flat fields (readable by graphify query):
| Field | Example |
|---|---|
id |
model.my_project.stg_orders |
label |
stg_orders |
layer |
staging |
type |
model |
materialized |
view |
description |
Cleans raw orders. Derives: status_label, days_to_ship. |
source_file |
models/staging/stg_orders.sql |
community |
1 |
upstream |
["source.my_project.raw.orders"] |
downstream |
["model.my_project.int_order_metrics", ...] |
database |
"analytics" |
schema |
"dbt_prod" |
columns |
["order_id", "customer_id", "status_label", ...] |
Community detection
Communities are assigned via this priority chain so the tool works on any dbt project, not just a specific domain:
- dbt
group— if your models use dbt groups, each group becomes a community - dbt
tags— first tag on each model becomes the community - Topology clustering — Louvain modularity on the DAG (requires
pip install "dbt-graphify[clustering]") - Layer fallback — source / staging / intermediate / mart / seed (always available)
Blast-radius analysis
lineage.json contains full ancestor and descendant maps computed via BFS:
import json
with open("graphify-out/lineage.json") as f:
lineage = json.load(f)
# Everything downstream of stg_customers
affected = lineage["descendants"]["model.my_project.stg_customers"]
print(f"Changing stg_customers breaks: {affected}")
Requirements
- Python ≥ 3.9
- A dbt project with
dbt compileordbt parserun (producestarget/manifest.jsonortarget/graph_summary.json) - graphify (
pip install graphifyy) forgraph.htmland query CLI — optional but recommended
License
MIT
Metadata
Release files for dbt-graphify 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dbt_graphify-0.1.7.tar.gz | 17.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dbt_graphify-0.1.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.7 kB
Release files / dbt_graphify-0.1.7.tar.gz
| Download URL | dbt_graphify-0.1.7.tar.gz |
|---|---|
| Size | 17.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
129463ac2aca386eed280d6082afa3965382c2db3c4ee4c1bf661dc8f4e25b27
|
|
BLAKE2b-256 checksum How to use checksums |
0da0942c270cc6ec5dfb4a366c0a970e36b3d97bd81d9b273847efe5c225959a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.11.17 Linux/6.17.0-1022-azure
|
Release files / dbt_graphify-0.1.7-py3-none-any.whl
| Download URL | dbt_graphify-0.1.7-py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c3d26ea61e26a93e4c3ac430eb8f553e99e39a4ae509467dbb72092b08be711
|
|
BLAKE2b-256 checksum How to use checksums |
fb64e8b775f46f5477f9b2a5cc07f4d07e798b122d5d9d2924a1bf66bb5ad29d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.11.17 Linux/6.17.0-1022-azure
|