Skip to content

feat: dbt 2.0 support — opt-in --info-schema plugin, optional catalog, reproducible output - #11

Merged
datnguye merged 19 commits into
mainfrom
feat/info-schema
Nov 14, 2026
Merged

datnguye merged 19 commits into
mainfrom
feat/info-schema

Conversation

@datnguye

@datnguye datnguye commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

What & why

Makes dbdocs work with dbt 2.0 artifacts and adds an opt-in path off JSON altogether. Tested end to end on jaffle-shop built with dbt-core 2.0.0rc10 (dbt-oss 2.0.11) and dbt Fusion 2.0.11 on DuckDB. Nineteen commits:

  1. chore: bump dbterd>=1.34, artifact-parser[dbt]>=1.0.1; make catalog.json optional. dbt 2.0's docs generate no longer writes catalog.json (even --write-catalog wrote nothing on 2.0.11 + DuckDB), and load_artifacts crashed with FileNotFoundError. It now returns catalog=None with a warning; every consumer already reads the catalog defensively, so columns fall back to the manifest (no warehouse types, reduced column lineage).
  2. fix: reproducible dbdocs-data.json. _leaf_columns returned leaves in sqlglot's walk order, which follows Python set iteration and changes with PYTHONHASHSEED, so columnLineage list order differed between runs on unchanged input (contradicting the "deterministic output" pattern; sort_keys doesn't sort lists). Leaves are now deduped into a set and sorted by (node, column). Output is now identical across hash seeds.
  3. feat: opt-in --info-schema plugin. dbt 2.0 writes a versioned parquet information schema (target/info_schema/v1/, via --generate-info-schema). With the flag, the plugin (dbdocs/sources/info_schema/) reads it with DuckDB as the base and any manifest.json / catalog.json / run_results.json present as enrichment, synthesizes standard manifest v12 / catalog v1 / run_results v6 into a temp dir, and runs the unchanged ReportBuilder.build_data on it. If dbt.column_lineage has rows (Fusion + --static-analysis strict), it replaces the sqlglot column lineage. Flag off, nothing changes: the only edits to existing code are config fields, the CLI flags, and ReportBuilder(config) → builder_for(config) in cli/main.py and site/deploy.py.
  4. docs: the two new flags in the CLI reference.
  5. ci: pin the e2e job to ubuntu-24.04. ubuntu-latest moved to 26.04, where Playwright can't install Chromium (Playwright does not support chromium on ubuntu26.04-x64); unrelated to this change, but it blocked the PR's e2e job. Pinned to the image it has always passed on.
  6. chore: require dbterd>=1.35 and artifact-parser[dbt]>=1.1.0. dbterd 1.35 ships the dbt 2.0 unit-test checksum fix (feat: dbt 2.0 support (checksum relax policy, --info-schema input) dbterd#174), so the default JSON path now parses a raw dbt 2.0 manifest.
  7. docs ×2: the new dbdocs/sources/ package in the CLAUDE.md layout and the pipeline-stage pattern; a dbt 2.0 path in the quickstart (dbdocs[info-schema], --generate-info-schema, Fusion --static-analysis strict) and the info_schema / info_schema_dir keys in the configuration guide.
  8. docs: a dbt 2.0 & Info Schema user-guide page (User Guide nav, after Configuration) that walks through enabling the plugin the intended way — info_schema: true in dbdocs.yml — with the CLI flags as per-run overrides: install the extra, have dbt write the info schema (dbt Fusion with --static-analysis strict vs dbt Core 2.0 tabs), how parquet and JSON combine, and a troubleshooting table keyed on the exact messages dbdocs prints. The quickstart callout, the configuration table and the CLI reference link to it.
  9. Review follow-ups (dbdocs-code-review + a lazy pass; each commit carries its docs/tests):
    • fix(sources): value lineage only. dbt.column_lineage marks each row with an evolution; scan rows (95 of 182 in the fixture) are join/filter/grouping keys that are read but don't feed the column — e.g. orders.order_total was listing order_items.order_id and stg_orders.order_id. They're now dropped (_READ_ONLY_EVOLUTIONS), so the overlay means the same thing as the sqlglot lineage; refs are deduplicated and sorted like the sqlglot path. The honest comparison is 87 vs 59 edges, not 182.
    • fix(sources): run_results resolves through the inherited, ..-escape-guarded _resolve_run_results_path (it was read straight off the config).
    • fix(sources): an unreadable/corrupt JSON enrichment artifact logs a warning instead of being dropped silently (a missing one stays quiet).
    • fix(sources): builder_for only blames DuckDB when duckdb is the missing module; any other ModuleNotFoundError re-raises.
    • perf(sources): each parquet table is read once per build (it was re-read up to 3×) and its DuckDB connection is closed.
    • refactor(sources): JSON-text columns decode with artifact-parser's decode_json_column instead of a local copy.
    • refactor: the CLI hands the chosen builder to deploy(builder=...), so site/ no longer imports sources/ (it was a two-way site/ ↔ sources/ dependency). deploy defaults to a plain ReportBuilder.
  10. chore: require dbterd>=1.35.1. dbterd 1.35.1 makes catalog.json optional (fix: make catalog.json optional (dbt 2.0 no longer writes it) dbterd#176), so a raw dbt 2.0 project with no catalog now builds on the default path too; a regression test (test_default_path_builds_a_catalog_less_dbt2_project) pins it and fails on dbterd 1.35.0. The quickstart no longer claims dbdocs needs both files.
  11. docs: correct quickstart step 2. It described an older design — a single self-contained site/index.html with base64-inlined data that works straight off the filesystem, written to ./site. It now matches how dbdocs works: output in target/site/ (output_dir), an external dbdocs-data.json.gz the page fetches, the api/v1/ tree, and why the site must be served.
  12. docs: a recorded dbt 2.0 → dbdocs GIF in the README (new On dbt 2.0 note; its quickstart's ./site corrected to target/site) and at the top of the guide page. It shows dbt Fusion dbt build --generate-info-schema --static-analysis strict on dbt-labs/jaffle-shop, dbdocs.yml with info_schema: true, dbdocs generate / dbdocs serve, then the served site in dark theme (overview, ERD, a model page with column lineage, the DAG, Health). 880 px, 3.9 MB. Re-recordable with docs/scripts/record-gif/record.sh (VHS + Playwright + ffmpeg; pins jaffle-shop 5beb145, records in a username-free /Users/Shared/jaffle_shop); docs/scripts/ is excluded from the published docs.

Both dbt 2.0 breakages on the default JSON path are fixed upstream and required here: dbterd 1.35's relax_checksum_objects parses the unit-test checksum object dbt 2.0 writes under the v12 schema, and dbterd 1.35.1 builds the ERD without catalog.json. Verified on the raw, catalog-less dbt 2.0 fixture with the flag off: 60 nodes / 13 ERD tables / 3 relationships / 64 lineage edges / 30 tests passing, with a warning that columns fall back to the manifest. --info-schema is unaffected.

Type of change

  • 🐞 Bug fix (non-breaking change that fixes an issue)
  • ✨ Feature (non-breaking change that adds capability)
  • 💥 Breaking change (existing behavior changes)
  • 🧹 Refactor / internal (no user-facing change)
  • 📖 Docs only

Mainly a feature; it also carries two non-breaking fixes (commits 1 and 2), a CI pin (5) and a dependency floor bump (6).

Area

  • CLI (generate / serve / deploy): --info-schema/--no-info-schema, --info-schema-dir on generate and deploy
  • extract/ (nodes / erd / graph / column_lineage / health): column_lineage._leaf_columns ordering
  • site/ (data dict / builder / 3-tier SPA / deploy): deploy.py uses builder_for
  • frontend/ (React Flow graph bundle)
  • Config (dbdocs.yml) / packaging / CI / docs: info_schema/info_schema_dir keys, optional extra dbdocs[info-schema] (duckdb>=1.1), dependency floors, CLI docs

How to test

task install && task test   # 508 tests, 100% coverage

# parquet only (no JSON at all): copy just the info schema out of the v2 fixture
mkdir -p /tmp/v2only/info_schema && cp -R tests/fixtures/jaffle_shop_v2/info_schema/v1 /tmp/v2only/info_schema/
printf "target_dir: /tmp/v2only\noutput_dir: /tmp/site-v2\n" > /tmp/dbdocs-v2.yml
uv run dbdocs -c /tmp/dbdocs-v2.yml generate --info-schema
uv run dbdocs -c /tmp/dbdocs-v2.yml serve        # then open http://localhost:8000

# flag off is reproducible across hash seeds (commit 2)
for s in 1 2; do PYTHONHASHSEED=$s uv run dbdocs generate -o /tmp/det-$s; done

Counts on tests/fixtures/jaffle_shop_v2 (Fusion 2.0.11 strict build):

Build Nodes ERD tables / edges Lineage edges Columns with lineage (edges) Health tests
JSON path (dbterd 1.35, raw manifest, empty catalog) 60 13 / 3 64 7 (7) 30 pass
--info-schema with JSON 60 13 / 3 64 85 (87) 30 pass
--info-schema, parquet only 60 13 / 3 64 85 (87) 30 pass

Checklist

  • task lint passes (ruff format --check + ruff check). Also ruff check --select PLC0415 (duckdb stays optional via importlib.import_module in builder_for, not an in-function import).
  • task test passes at 100% coverage (the gate is enforced in CI): 508 passed. Commit 1 alone also passes (462).
  • I followed the load-bearing patterns in .claude/design_patterns.md (extended an existing seam, didn't fork one). If I added/removed a pattern, I updated that doc + its TOC in this PR. New entry "Opt-in artifact-source plugin (info_schema)" + TOC; the "Centralized artifact loading" entry notes the optional catalog.
  • Data-dict / SPA changes keep producer ↔ consumer in sync (Python builder ⇄ the 3-tier assets/js/ modules) and don't re-inline the payload: the data-dict shape is unchanged; the plugin feeds the existing builder, and only metadata.artifact_source is added on the info-schema path.
  • Graph-UI changes rebuilt the committed bundle (task frontend:build) and I committed dbdocs/site/bundle/assets/graph/: n/a, frontend/ untouched.
  • New files under dbdocs/site/bundle/** are covered by the pyproject.toml artifacts glob (so they ship in the wheel): n/a, no new bundle files.
  • Docs / dbdocs.yml.example updated for any new config knob or CLI flag: docs/nav/guide/cli-references.md and dbdocs.yml.example.

Screenshots / notes

  • Merge rule (one rule, in synth.py): the parquet set decides which records exist; a non-empty parquet value wins; JSON fills gaps. Column types: catalog.json warehouse type > info-schema actual > declared > inferred (inferred types are Arrow-style, e.g. Int64).
  • Gap: with no JSON at all, the model page's "Macros used" is empty. The info schema has no model→macro edges.
  • Fixture: tests/fixtures/jaffle_shop_v2/ is a dbt Fusion 2.0.11 build --static-analysis strict --generate-info-schema of dbt-labs/jaffle-shop (1.4 MB; absolute paths scrubbed). It has no catalog.json, as dbt 2.0 writes it.
  • Not in scope: the plugin keeps its own DuckDB reader + parquet → manifest synthesis. Swapping it onto artifact-parser's parse_info_schema would change only internals (dbdocs' extractors still need manifest-shaped data), so it isn't planned; the opt-in stays info_schema: true / --info-schema.

@datnguye
datnguye merged commit e17a04d into main Nov 14, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants