Skip to main content

dbt-extra — Modular joint icon

dbt-extra — dbt transformation review and inspection

License: MIT Python 3.11+ CI Documentation

Get started · Documentation · AI-assisted workflow · Native dbt demo · Contributing

Trace a dbt column back to its SQL. Review transformations in Excel. Preview edits to the original files—all offline.

Where does revenue come from? Which filters change it? Can a reviewer update its description without hunting through YAML? dbt-extra helps answer those questions using the dbt project you already have. No warehouse credentials, dbt compilation, or second model language required.

See where a column comes from

Requires Python 3.11+ and uv. From a terminal:

git clone https://github.com/billybillysss/dbt-extra.git
cd dbt-extra
uv sync --locked
uv run --locked extra --project-dir examples/jaffle_shop inspect customer_revenue --columns revenue --compile false

The bundled example follows customer_revenue → orders → demo_raw_orders. The explanation retains the completed-order filter, decimal cast and per-customer grouping, even though you selected only revenue.

See the SQL output (CLI comments omitted)
SELECT
  "extra_selected_output"."revenue" AS "revenue"
FROM (
  WITH order_totals AS (
    SELECT
      SUM(CAST("extra_input_2".amount AS DECIMAL(12, 2))) AS revenue
    FROM {{ ref('demo_raw_orders') }} AS "extra_input_2"
    WHERE
      "extra_input_2".status = 'completed'
    GROUP BY
      "extra_input_2".customer_id
  )
  SELECT
    order_totals.revenue + 0 AS revenue
  FROM order_totals AS order_totals
) AS "extra_selected_output";

This is a definition explanation, not executed SQL or proof about stored data. The seed remains an explicit boundary. Authored files are unchanged.

Stop at an upstream model with --from orders, or use --view plan for a logical tree. Try the walkthrough →

Private preview · 0.1.0: install from this checkout with repository access. The executable is extra; Python imports use dbt_extra.

Pick your workflow

You want to… Use dbt-extra to…
Understand one output column Follow supported upstream SQL while retaining joins, filters, grouping and row multiplicity.
Review SQL and metadata together Export a folder-grouped XLSX workbook or CSV, edit supported cells, and preview diffs back to dbt files.
Review an AI-proposed change Export read-only JSON with SQL, dependencies, column lineage and explicit coverage reasons for an external assistant.
Clean up authored SQL Preview conservative rewrites that preserve dbt calls; unsafe or opaque cases are skipped with reasons.
Fill missing documentation Infer available types and unambiguous passthrough descriptions without overwriting authored metadata.

Review in Excel, apply through a diff

uv run --locked extra --project-dir examples/jaffle_shop export --format xlsx --select customer_revenue
# Edit supported cells in examples/jaffle_shop/extra/review/review.xlsx, then close Excel.
uv run --locked extra --project-dir examples/jaffle_shop import examples/jaffle_shop/extra/review/review.xlsx --preview

The workbook groups TABLE → STEP / OUTPUT → COLUMN rows. Supported edits patch the original SQL/YAML; stale exports are rejected, YAML comments are preserved, and unchanged files keep their bytes. Preview writes nothing. Follow the round-trip walkthrough before applying edits.

Preview SQL cleanup and metadata proposals

uv run --locked extra --project-dir examples/jaffle_shop optimize --select customer_revenue --preview
uv run --locked extra --project-dir examples/jaffle_shop enrich --select customer_revenue --preview

For more visible before/after SQL rewrites, try the 14 focused optimizer demos. Logical cleanup is not a measured warehouse speedup.

Use your existing dbt project

Point --project-dir at your project and supply its actual SQL dialect:

uv run --locked extra --project-dir path/to/your/dbt_project --dialect snowflake inspect your_model --columns your_column

dbt SQL and property YAML remain the source of truth. No initialization is required. Optional extra_project.yaml stores tool settings only:

version: 2
analysis:
  dialect: duckdb
export:
  format: xlsx
  output_dir: extra/review
  select:
    - 'path:models/gld/**'
optimization:
  format: pretty
  preserve_macros: true

Explicit CLI values replace configured values, including lists. --preview (--dry-run) writes no files. Without it, writing commands apply their documented writes. See the existing-project guide for artifact and dialect setup.

Python API

from dbt_extra import Project
from dbt_extra.analysis import catalog
from dbt_extra.optimization import optimize

project = Project("examples/jaffle_shop")
document = catalog(project, project.select(["customer_revenue"]))
changes, skipped = optimize(project, select=["customer_revenue"])
print(changes.diffs())
# changes.apply()  # Explicitly accept the proposed source edits.

The CLI is the preferred entry point; Python integrations should pin and test versions. See architecture for module boundaries.

Safety and maturity

extra is pre-1.0 and conservative by design:

  • Unknowns stay explicit. Coverage depends on dialect, schemas and Jinja. Bounded static local macros can be previewed; runtime/adapter-dependent macros remain opaque. Generated SQL never replaces an authored macro call.
  • dbt still owns execution. dbt-extra is not a dbt engine, metrics service or warehouse optimizer. Inspection explains definitions, not equivalence to persisted or incremental relations. Run your own dbt parsing, tests and builds.
  • Writes still need review. Package/artifact-only resources and inherited version properties are read-only. Full opaque-template edits are structure-checked, not dbt-compiled. Baseline checks and rollback attempts are not crash-safe multi-file transactions or file locks.

See compatibility and the production adoption checklist.

Help shape dbt-extra

Try one model from your own project. If analysis stops, share a minimal redacted reproduction and the coverage reason in an issue. Dialect edge cases, documentation improvements and regression tests are especially useful. Read Contributing to get started; report vulnerabilities through the security policy, not a public bug report.

Get started · CLI · Configuration · Review contract · Inspection and optimization · Native example · Contributing

Metadata

Release files for dbt-extra 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dbt-extra 0.1.0
File Size Uploaded Provenance Actions
dbt_extra-0.1.0.tar.gz 265.5 kB Without provenance Details for dbt_extra-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dbt-extra 0.1.0
File Interpreter ABI Platform Actions
dbt_extra-0.1.0-py3-none-any.whl Python 3 none any Details for dbt_extra-0.1.0-py3-none-any.whl

Total release size: 349.6 kB

Release files / dbt_extra-0.1.0.tar.gz

Download URL dbt_extra-0.1.0.tar.gz
Size 265.5 kB
Tags Source
SHA-256 checksum
How to use checksums
158acb4c3650d563ba5e5121eb359d81d92d0dfab6e57a813d675038e5052183
BLAKE2b-256 checksum
How to use checksums
28eeaaea6e667d8b9433209e087e6c2787aee0c8a54a4bfebc8ec9261fa81405
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / dbt_extra-0.1.0-py3-none-any.whl

Download URL dbt_extra-0.1.0-py3-none-any.whl
Size 84.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0b378818ae76eae0d708ab5ddc6f44056a96a1782b0b9a15ed9bede35165d82
BLAKE2b-256 checksum
How to use checksums
5b2e566e04715a1fbf34876ec58e38fd11b4ac3386450611a6b5f1084ecdf78a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for dbt-extra 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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