Skip to content

fix: return True from has_dbr_capability parse stub on SQL warehouses (#1331) - #1449

Merged
sd-db merged 3 commits into
mainfrom
sd-db/fix/issue-1331-warehouse-only-parse-stub
May 22, 2026
Merged

fix: return True from has_dbr_capability parse stub on SQL warehouses (#1331)#1449
sd-db merged 3 commits into
mainfrom
sd-db/fix/issue-1331-warehouse-only-parse-stub

Conversation

@sd-db

@sd-db sd-db commented May 11, 2026

Copy link
Copy Markdown
Collaborator

Motivated by #1331.

The class-level @available.parse(lambda *a, **k: False) stub on has_dbr_capability returns a constant False at parse time, so every macro branching on a capability takes the legacy path during parse/compile — even on SQL warehouses, which support all capabilities we currently ship.

This is a 1.11.0 regression: the pre-1.11 stub (compare_dbr_version) returned 0, and 0 >= 0 accidentally selected the modern path.

Fix

Shadow _parse_replacements_ at adapter __init__ with a bound method that consults the profile's http_path:

  • SQL warehouseTrue for capabilities with sql_warehouse_supported=True.
  • ClusterFalse (real DBR version is only known at runtime).

Cluster users on supported DBR are still affected — fully fixing that requires a larger change. This PR is the contained warehouse-only fix.

Test plan

  • hatch run pytest tests/unit/test_adapter_capabilities.py -v — 19 pass (4 new).
  • hatch run pre-commit run --all-files — clean.
  • CI functional run.

@github-actions

github-actions Bot commented May 11, 2026

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  dbt/adapters/databricks
  impl.py
Project Total  

This report was generated by python-coverage-comment-action

@sd-db sd-db self-assigned this May 11, 2026
@nicor88

nicor88 commented May 11, 2026

Copy link
Copy Markdown

@sd-db you can consider to add real functional tests in which for example a date-spine function from dbt-utils is used to check if everything actually works fine with a real warehouse, alternatively something artifically created like date-spine to test a real scenario. The unit tests cover some relevant aspects, but proper integration testings allows to spot regressions in a more solid way.

@sd-db

sd-db commented May 12, 2026

Copy link
Copy Markdown
Collaborator Author

@sd-db you can consider to add real functional tests in which for example a date-spine function from dbt-utils is used to check if everything actually works fine with a real warehouse, alternatively something artifically created like date-spine to test a real scenario. The unit tests cover some relevant aspects, but proper integration testings allows to spot regressions in a more solid way.

Good call — added a functional test in tests/functional/adapter/utils/test_dateadd_uppercase.py (commit d6fe3dd).

Comment thread CHANGELOG.md Outdated
@sd-db
sd-db force-pushed the sd-db/fix/issue-1331-warehouse-only-parse-stub branch from d4bb343 to a49ad02 Compare May 14, 2026 07:54
Base automatically changed from 1.12.latest to main May 14, 2026 13:08
@sd-db
sd-db changed the base branch from main to 1.12.latest May 15, 2026 11:22
@sd-db
sd-db changed the base branch from 1.12.latest to main May 15, 2026 11:32
sd-db added 2 commits May 15, 2026 17:06
…#1331)

Capability-branching macros were falling through to their legacy path
at parse/compile time on SQL warehouses because the parse-time stub of
has_dbr_capability returned False unconditionally. Return True for
warehouse profiles when the capability is flagged
sql_warehouse_supported, so macros select the modern branch during
compilation instead of the legacy fallback.
@sd-db
sd-db force-pushed the sd-db/fix/issue-1331-warehouse-only-parse-stub branch from c5edc46 to 9a23fb0 Compare May 15, 2026 11:37
@sd-db
sd-db merged commit 192317e into main May 22, 2026
7 checks passed
@sd-db
sd-db deleted the sd-db/fix/issue-1331-warehouse-only-parse-stub branch May 22, 2026 17:00
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.

4 participants