Skip to main content

CLI and library for exploring dbt manifests as graphs.

Project description

dbt-pathfinder

🔎 Explore, debug, and understand your dbt lineage — fast.

dbt-pathfinder is a Python CLI + library that parses your manifest.json and turns it into a navigable graph of your dbt project.

It helps you answer questions like:

  • “What breaks if I change this model?”
  • “How are these two models connected?”
  • “What joins actually exist along this path?”
  • “Is this relationship 1:1 or 1:N?”

🚀 Why this exists

dbt gives you lineage… but not exploration.

When projects scale:

  • lineage graphs get noisy
  • impact analysis becomes manual
  • understanding joins requires digging through SQL

dbt-pathfinder bridges that gap: 👉 fast CLI exploration 👉 precise impact analysis 👉 inferred join + cardinality insight


✨ Features

🔍 show

Inspect a node and its immediate relationships

dbt-pathfinder show --manifest target/manifest.json --model fct_orders

Outputs:

  • node metadata
  • upstream dependencies
  • downstream children

💥 impact

See everything downstream of a model (grouped by depth)

dbt-pathfinder impact --manifest target/manifest.json --model stg_orders

Example output:

Depth 1:
- fct_orders
- dim_customers

Depth 2:
- mart_customer_ltv

Perfect for:

  • change impact analysis
  • safe refactoring
  • CI/CD validation

🧭 path

Find the shortest path between two nodes

dbt-pathfinder path \
  --manifest target/manifest.json \
  --from stg_orders \
  --to mart_customer_ltv

Supports:

  • --mode directed (default)
  • --mode any (for debugging unexpected relationships)

🧠 path-explain (🔥 killer feature)

Explain how models are connected — not just that they are.

dbt-pathfinder path-explain \
  --manifest target/manifest.json \
  --from stg_orders \
  --to mart_customer_ltv

Includes:

  • inferred join conditions (JOIN ... ON ...)

  • join keys

  • inferred cardinality:

    • 1:1
    • 1:N
    • N:1
    • N:N
  • confidence level

⚠️ Note: inference is heuristic and depends on SQL structure and dbt tests.


📦 Installation

From PyPI (recommended)

pip install dbt-pathfinder

From source (dev)

git clone https://github.com/<your-username>/dbt-pathfinder.git
cd dbt-pathfinder
pip install -e ".[dev]"

⚡ Quick Start

  1. Generate your dbt manifest:
dbt compile
  1. Run:
dbt-pathfinder show --manifest target/manifest.json --model my_model

🧰 CLI Usage

dbt-pathfinder --help

Examples:

dbt-pathfinder show --manifest target/manifest.json --model fct_orders --verbose

dbt-pathfinder impact --manifest target/manifest.json --model stg_orders

dbt-pathfinder impact --manifest target/manifest.json --model stg_orders --output json

dbt-pathfinder path --manifest target/manifest.json --from stg_orders --to mart_customer_ltv

dbt-pathfinder path-explain --manifest target/manifest.json --from stg_orders --to mart_customer_ltv --ui rich

🖥 Output Modes

  • --ui rich (default): formatted terminal output
  • --ui text: plain text
  • --output json: machine-readable (great for CI/CD)

🧱 Library Usage

You can also use dbt-pathfinder programmatically:

from dbt_pathfinder.services.pathfinder_service import PathfinderService

service = PathfinderService.from_manifest("target/manifest.json")

print(service.show("fct_orders"))
print(service.impact("stg_orders"))
print(service.path("stg_orders", "mart_customer_ltv", directed=True))
print(service.explain_path("stg_orders", "mart_customer_ltv", directed=True))

🧠 How it works

  • Parses dbt manifest.json

  • Builds a directed graph:

    upstream → downstream
    
  • Uses:

    • graph traversal for lineage + paths
    • SQL parsing heuristics for join inference
    • dbt tests (unique, not_null) for cardinality hints

⚠️ Limitations

  • Join inference is best-effort (complex SQL/macros may reduce accuracy)
  • Requires a valid dbt manifest.json
  • Ambiguous model names may require full unique_id

🛠 Roadmap

  • CI/CD integration for impact analysis in PRs
  • Visualization (graph output / web UI)
  • dbt Cloud integration
  • Column-level lineage support
  • Better SQL parsing for complex joins

🤝 Contributing

Contributions welcome!

  1. Fork the repo
  2. Create a feature branch
  3. Add tests
  4. Open a PR

⭐ Support

If this tool helps you:

  • ⭐ Star the repo
  • 🐛 Open issues
  • 💡 Suggest features

📄 License

MIT License

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_pathfinder-0.1.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

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

dbt_pathfinder-0.1.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file dbt_pathfinder-0.1.0.tar.gz.

File metadata

  • Download URL: dbt_pathfinder-0.1.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for dbt_pathfinder-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a191c17b51342a0a9704d9449fff70dc5a94c773e324ae686b24e2150ca40b34
MD5 45c3a01518c439d8c5098474badc0589
BLAKE2b-256 aba150c02741427cf398fbf5e6a8475510e2f0888c2873726190de59dda6b85a

See more details on using hashes here.

File details

Details for the file dbt_pathfinder-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dbt_pathfinder-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for dbt_pathfinder-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 784991dfadbb6094553f7e1caa605aa824b84b68519773f9dbce90807e83aec2
MD5 3f22dac60587dac5622746d68b189bcd
BLAKE2b-256 793a476de706639597a0c367b1444be2d45326d5dd5c821df3139937a3b1ad08

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