fix: return True from has_dbr_capability parse stub on SQL warehouses (#1331) - #1449
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
|
@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 |
d4bb343 to
a49ad02
Compare
…#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.
c5edc46 to
9a23fb0
Compare
Motivated by #1331.
The class-level
@available.parse(lambda *a, **k: False)stub onhas_dbr_capabilityreturns a constantFalseat 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) returned0, and0 >= 0accidentally selected the modern path.Fix
Shadow
_parse_replacements_at adapter__init__with a bound method that consults the profile'shttp_path:Truefor capabilities withsql_warehouse_supported=True.False(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.