Repository navigation
feat: dbt 2.0 support — opt-in --info-schema plugin, optional catalog, reproducible output - #11
Merged
Merged
Conversation
…n optional for dbt 2.0
…can rows), sorted and deduplicated
…ead of dropping it silently
… close its DuckDB connection
…s on the default path
…info-schema guide
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
chore: bumpdbterd>=1.34,artifact-parser[dbt]>=1.0.1; makecatalog.jsonoptional. dbt 2.0'sdocs generateno longer writescatalog.json(even--write-catalogwrote nothing on 2.0.11 + DuckDB), andload_artifactscrashed withFileNotFoundError. It now returnscatalog=Nonewith a warning; every consumer already reads the catalog defensively, so columns fall back to the manifest (no warehouse types, reduced column lineage).fix: reproducibledbdocs-data.json._leaf_columnsreturned leaves in sqlglot's walk order, which follows Python set iteration and changes withPYTHONHASHSEED, socolumnLineagelist order differed between runs on unchanged input (contradicting the "deterministic output" pattern;sort_keysdoesn't sort lists). Leaves are now deduped into a set and sorted by(node, column). Output is now identical across hash seeds.feat: opt-in--info-schemaplugin. 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 anymanifest.json/catalog.json/run_results.jsonpresent as enrichment, synthesizes standard manifest v12 / catalog v1 / run_results v6 into a temp dir, and runs the unchangedReportBuilder.build_dataon it. Ifdbt.column_lineagehas 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, andReportBuilder(config)→builder_for(config)incli/main.pyandsite/deploy.py.docs: the two new flags in the CLI reference.ci: pin the e2e job toubuntu-24.04.ubuntu-latestmoved 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.chore: requiredbterd>=1.35andartifact-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.docs×2: the newdbdocs/sources/package in theCLAUDE.mdlayout and the pipeline-stage pattern; a dbt 2.0 path in the quickstart (dbdocs[info-schema],--generate-info-schema, Fusion--static-analysis strict) and theinfo_schema/info_schema_dirkeys in the configuration guide.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: trueindbdocs.yml— with the CLI flags as per-run overrides: install the extra, have dbt write the info schema (dbt Fusion with--static-analysis strictvs 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.dbdocs-code-review+ a lazy pass; each commit carries its docs/tests):fix(sources): value lineage only.dbt.column_lineagemarks each row with anevolution;scanrows (95 of 182 in the fixture) are join/filter/grouping keys that are read but don't feed the column — e.g.orders.order_totalwas listingorder_items.order_idandstg_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_resultsresolves 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_foronly blames DuckDB whenduckdbis the missing module; any otherModuleNotFoundErrorre-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'sdecode_json_columninstead of a local copy.refactor: the CLI hands the chosen builder todeploy(builder=...), sosite/no longer importssources/(it was a two-waysite/↔sources/dependency).deploydefaults to a plainReportBuilder.chore: requiredbterd>=1.35.1. dbterd 1.35.1 makescatalog.jsonoptional (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.docs: correct quickstart step 2. It described an older design — a single self-containedsite/index.htmlwith base64-inlined data that works straight off the filesystem, written to./site. It now matches how dbdocs works: output intarget/site/(output_dir), an externaldbdocs-data.json.gzthe page fetches, theapi/v1/tree, and why the site must be served.docs: a recorded dbt 2.0 → dbdocs GIF in the README (new On dbt 2.0 note; its quickstart's./sitecorrected totarget/site) and at the top of the guide page. It shows dbt Fusiondbt build --generate-info-schema --static-analysis stricton dbt-labs/jaffle-shop,dbdocs.ymlwithinfo_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 withdocs/scripts/record-gif/record.sh(VHS + Playwright + ffmpeg; pins jaffle-shop5beb145, 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_objectsparses the unit-testchecksumobject dbt 2.0 writes under the v12 schema, and dbterd 1.35.1 builds the ERD withoutcatalog.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-schemais unaffected.Type of change
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
generate/serve/deploy):--info-schema/--no-info-schema,--info-schema-dirongenerateanddeployextract/(nodes / erd / graph / column_lineage / health):column_lineage._leaf_columnsorderingsite/(data dict / builder / 3-tier SPA / deploy):deploy.pyusesbuilder_forfrontend/(React Flow graph bundle)dbdocs.yml) / packaging / CI / docs:info_schema/info_schema_dirkeys, optional extradbdocs[info-schema](duckdb>=1.1), dependency floors, CLI docsHow to test
Counts on
tests/fixtures/jaffle_shop_v2(Fusion 2.0.11 strict build):--info-schemawith JSON--info-schema, parquet onlyChecklist
task lintpasses (ruff format --check+ruff check). Alsoruff check --select PLC0415(duckdb stays optional viaimportlib.import_moduleinbuilder_for, not an in-function import).task testpasses at 100% coverage (the gate is enforced in CI): 508 passed. Commit 1 alone also passes (462)..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.assets/js/modules) and don't re-inline the payload: the data-dict shape is unchanged; the plugin feeds the existing builder, and onlymetadata.artifact_sourceis added on the info-schema path.task frontend:build) and I committeddbdocs/site/bundle/assets/graph/: n/a,frontend/untouched.dbdocs/site/bundle/**are covered by thepyproject.tomlartifacts glob (so they ship in the wheel): n/a, no new bundle files.dbdocs.yml.exampleupdated for any new config knob or CLI flag:docs/nav/guide/cli-references.mdanddbdocs.yml.example.Screenshots / notes
synth.py): the parquet set decides which records exist; a non-empty parquet value wins; JSON fills gaps. Column types:catalog.jsonwarehouse type > info-schema actual > declared > inferred (inferred types are Arrow-style, e.g.Int64).tests/fixtures/jaffle_shop_v2/is a dbt Fusion 2.0.11build --static-analysis strict --generate-info-schemaof dbt-labs/jaffle-shop (1.4 MB; absolute paths scrubbed). It has nocatalog.json, as dbt 2.0 writes it.parse_info_schemawould change only internals (dbdocs' extractors still need manifest-shaped data), so it isn't planned; the opt-in staysinfo_schema: true/--info-schema.