[CT-3260] [Regression] Missing contract enforcement checks on temporary tables #8896
Closed
2 tasks done
Labels
backport 1.5.latest
backport 1.6.latest
backport 1.7.latest
bug
Something isn't working
Impact: Adapters
regression
Is this a regression in a recent version of dbt-core?
Current Behavior
contract enforcement checks aren't happening for an incremental model during an incremental run on Postgres
Expected/Previous Behavior
Contracts should be enforced for temporary tables
Steps To Reproduce
and:
Run that. Then change the model SQL to select 123 as int_column, and run again. dbt should raise an error
Relevant log output
Right now it runs without error. dbt will happily add a new column to the incremental model:
Environment
Which database adapter are you using with dbt?
No response
Additional Context
After looking a bit more closely at the change in #8768 I believe it has a larger scope than the effect desired.
When we had previously talked about the scope of the fix for that bug (#8022 (comment)), I'd said something like:
Whereas, I believe the change implemented in Fix #8022: Foreign key constraint on incremental model results in Database Error #8768 also disables the "pre-flight" contract check on an incremental builds of incremental models, including the "pre-flight" check in get_assert_columns_equivalent. If you have on_schema_change configured to evolve the schema accordingly, you'll end up with an output that hasn't been checked against the yaml contract. That's not right.
This change affects users of dbt-postgres, but I don't believe it affects any users of Redshift/Snowflake/BigQuery/Databricks.
The text was updated successfully, but these errors were encountered: