fix: suppress warning on materialization v2 behavior flags.#1431
fix: suppress warning on materialization v2 behavior flags.#1431tejassp-db wants to merge 4 commits intomainfrom
Conversation
Materialization v2 behavior flag is never going to be default true. Suppress all warnings using no_warn calls in all code paths.
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
sd-db
left a comment
There was a problem hiding this comment.
Code changes look good, best to remove functional tests for the change
| ) | ||
| assert results[0][1] == expected_struct_type | ||
|
|
||
| def test_use_materialization_v2_warning_absent(self, project, my_table): |
There was a problem hiding this comment.
We should not add any functional test for this change. Functional check general behaviour and should not be used to check for logs/messages. This is better to be had as unit tests.
|
|
||
| class TestMaterializationV2BehaviorFlag(DatabricksAdapterBase): | ||
| """The `use_materialization_v2` deprecation warning must not fire on every dbt run. | ||
| The fix routes all 4 Jinja-side accesses through `adapter.get_behavior_flag_no_warn(...)`, |
There was a problem hiding this comment.
nit: make comment less verbose/not leak specific implementation details.
sd-db
left a comment
There was a problem hiding this comment.
Changes look good, there seems to be a stray line (probably an artifact from the recentl fixes, that we forgot ro remove)
| from dbt.tests.adapter.materialized_view import files | ||
| from dbt.tests.adapter.materialized_view.basic import MaterializedViewBasic | ||
|
|
||
| from dbt.adapters.databricks.impl import USE_MATERIALIZATION_V2 |
|
/integration-test |
|
Integration tests dispatched for PR #1431 by @tejassp-db. Track progress in the Actions tab. |
|
Integration results for PR #1431 — UC cluster ❌ failure · SQL warehouse ✅ success · All-purpose cluster ❌ failure |
Fixes #1089.
dbt-core's BehaviorFlag emits a deprecation warning the first time a flag with default=False is read. As a result, every dbt run with incremental materialization logs a confusing use_materialization_v2 warning on every model, with no clean way to silence it short of opting in to the flag itself.
This PR fixes this by accessing the flag with no_warn in the code paths. A new get_behavior_flag_no_warn helper on the adapter is decorated with @available so Jinja can call it at runtime. All four materialization macros that gate v1/v2 (table.sql, view.sql, seeds.sql, incremental.sql) now route through that helper, which reads the flag via BehaviorFlagRendered.no_warn and bypasses the BehaviorChangeEvent entirely.
PECOBLR-2649