Skip to content

fix(cll): skip parents without catalog columns in sqlglot schema - #1578

Draft
gcko wants to merge 2 commits into
mainfrom
feature/drc-4918-cll-returns-unknown-for-any-model-whose-parent-is-missing
Draft

gcko wants to merge 2 commits into
mainfrom
feature/drc-4918-cll-returns-unknown-for-any-model-whose-parent-is-missing

Conversation

@gcko

@gcko gcko commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

PR checklist

  • Ensure you have added or ran the appropriate tests for your PR.
  • DCO signed

What type of PR is this?

Bug fix

What this PR does / why we need it:

DbtAdapter builds the sqlglot schema for cll(). A parent missing from catalog.json (uncataloged source, ephemeral model, incomplete dbt docs generate) was written as an empty column mapping. sqlglot rejects zero-column tables, so the whole model fell back to transformation_type="unknown", including columns that come from cataloged parents.

This PR skips parents with no catalog columns in both schema builders:

  • _build_schema_from_aliases (pre-compiled path)
  • the inline schema loop in the Jinja fallback path of get_cll

Cataloged parents and table-qualified columns now resolve. Columns that only the missing parent could supply stay unattributed. Attributing them to the single schemaless source is a separate product decision (option 2 in the issue) and is not included here.

Tests in tests/adapter/dbt_adapter/test_dbt_cll.py:

  • test_build_schema_from_aliases_omits_parents_without_catalog_columns (unit)
  • test_cll_pre_compiled_with_parent_missing_from_catalog_keeps_cataloged_columns
  • test_cll_jinja_path_with_parent_missing_from_catalog_keeps_cataloged_columns
  • test_change_analysis_ignores_parent_without_columns (in test_dbt_adapter.py)

Run: python -m pytest tests/adapter/dbt_adapter/test_dbt_cll.py tests/adapter/dbt_adapter/test_dbt_adapter.py → 65 passed.

Which issue(s) this PR fixes:

Implements DRC-4918

Special notes for your reviewer:

  • Deviation from the TDD checkpoint flow: the red and green work landed in one commit rather than separate checkpoint commits.
  • Second commit: the change-analysis _get_schema helper (get_change_analysis_cached) had the same empty-entry bug. Its regression test is test_change_analysis_ignores_parent_without_columns. Before the fix the result was {'id': 'added', 'a': 'added'}, and after it is {'b': 'removed'}.
  • Known limit (option 1 by design): a select * over a join that includes a schemaless parent still cannot be expanded, so its column diff stays imprecise. Attributing those columns is option 2, which is out of scope.

Does this PR introduce a user-facing change?:

Column-level lineage no longer marks a whole model as unknown when one of its parents is missing from catalog.json; columns from cataloged parents now resolve.

🤖 Generated with Claude Code

gcko and others added 2 commits October 21, 2026 11:00
A parent missing from catalog.json (uncataloged source, ephemeral model, or an
incomplete dbt docs generate) was written to the sqlglot schema as an empty
mapping. sqlglot rejects zero-column tables, so the whole model fell back to
transformation_type=unknown, including columns from cataloged parents.

Leave such parents out of the schema in both _build_schema_from_aliases and
the Jinja fallback loop in get_cll. Table-qualified and cataloged columns now
resolve; columns that only the missing parent could supply stay unattributed.

Implements [DRC-4918](https://linear.app/recce/issue/DRC-4918)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Signed-off-by: Jared Scott <jared.scott@datarecce.io>
The change-analysis schema in get_change_analysis_cached wrote an empty table for
any parent with no manifest columns. sqlglot then skips qualify() for the whole
statement, so a select * could not expand and the column diff was wrong.

Skip such parents, matching the CLL schema builders. Adds a regression test
where the empty parent is in depends_on but not referenced in the SQL.

Known limit: a select * over a join that includes a schemaless table still
cannot be expanded. Option 1 leaves that unattributed by design.

Implements [DRC-4918](https://linear.app/recce/issue/DRC-4918)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Signed-off-by: Jared Scott <jared.scott@datarecce.io>
@codecov

codecov Bot commented Oct 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
recce/adapter/dbt_adapter/__init__.py 79.78% <100.00%> (+0.08%) ⬆️
tests/adapter/dbt_adapter/test_dbt_adapter.py 100.00% <100.00%> (ø)
tests/adapter/dbt_adapter/test_dbt_cll.py 99.39% <100.00%> (+0.03%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant