Skip to content

Commit 5b7bae6

Browse files
committed
fix: warn on contract.enforced=true for materialized_view (#1279)
Upstream dbt does not support contracts on materialized views (https://docs.getdbt.com/docs/mesh/govern/model-contracts). dbt-databricks was silently accepting the flag, hiding yml/SQL drift. Now emits a warning pointing at the dbt docs. Strictly additive; existing build outcomes and constraint behavior are unchanged. Co-authored-by: Isaac
1 parent 59c69f6 commit 5b7bae6

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## dbt-databricks 1.11.8 (TBD)
2+
3+
### Fixes
4+
5+
- Warn when `contract.enforced: true` is set on a `materialized_view` model ([#1279](https://github.com/databricks/dbt-databricks/issues/1279))
6+
17
## dbt-databricks 1.11.7 (Apr 17, 2026)
28

39
### Features

dbt/include/databricks/macros/relations/materialized_view/create.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
{%- set model_columns = model.get('columns', {}) -%}
2525
{%- set contract_config = config.get('contract') -%}
2626
{%- if contract_config and contract_config.enforced -%}
27+
{%- do exceptions.warn(
28+
"model '" ~ model.name ~ "' sets contract.enforced=true, but contracts are not supported for materialized_view. See https://docs.getdbt.com/docs/mesh/govern/model-contracts"
29+
) -%}
2730
{%- set model_constraints = model.get('constraints', []) -%}
2831
{%- else -%}
2932
{%- set model_constraints = [] -%}

0 commit comments

Comments
 (0)