Skip to main content

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

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:

  1. dbt group — if your models use dbt groups, each group becomes a community
  2. dbt tags — first tag on each model becomes the community
  3. Topology clustering — Louvain modularity on the DAG (requires pip install "dbt-graphify[clustering]")
  4. 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 compile or dbt parse run (produces target/manifest.json or target/graph_summary.json)
  • graphify (pip install graphifyy) for graph.html and query CLI — optional but recommended

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbt_graphify-0.1.1.tar.gz (13.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_graphify-0.1.1-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file dbt_graphify-0.1.1.tar.gz.

File metadata

  • Download URL: dbt_graphify-0.1.1.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.11.15 Linux/6.17.0-1020-azure

File hashes

Hashes for dbt_graphify-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6361709a077334561204759c211663625101b515e4a1fcffe88432f282813030
MD5 5319b38ebf6bc2a5039a33833349bd60
BLAKE2b-256 a645839f6cf54ecd48523656f89a244e29788009f4034cd4c332cebdaf86afb6

See more details on using hashes here.

File details

Details for the file dbt_graphify-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: dbt_graphify-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.11.15 Linux/6.17.0-1020-azure

File hashes

Hashes for dbt_graphify-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 308ef7722d43c6d2ca5dd89acd44eb6b02b39dd096dc6b55c815550ad11798c0
MD5 71f473fec6cc0f4e57e9db4b6060a749
BLAKE2b-256 753c06f94d25c5ab66be7743a362683a3b1809a92a001d8d327b549d1bb3575d

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.2

2 files

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page