[ADAP-1008] [Bug] dbt does not create _dbt_max_partition
for subsequent runs of models that are incremental (insert_overwrite) + partitioned + contract enforced.
#583
Labels
feature:model-contracts
Issues related to model contracts
feature:partitioning
Issues related to table partitioning
pkg:dbt-bigquery
Issue affects dbt-bigquery
type:bug
Something isn't working as documented
Is this a new bug in dbt-bigquery?
Current Behavior
As per title, if a model is:
Then the subsequent run does not declare the
_dbt_max_partition
variable as opposed to when the model was not contract enforced.This results in an error if the model uses
_dbt_max_partition
in it's body.Expected Behavior
We should be creating
_dbt_max_partition
regardless of contract enforcement.Steps To Reproduce
Relevant log output
Environment
Additional Context
Basically, when contract is enforced, we did not do:
Plus other DDL/DML.
I think in the schema enforced scenario - we try to first figure out what the data types are via this introspection query:
We need to know the data types to know if any datatypes have drifted and thus to raise an error or append new columns (
on_schema_change
config).Unfortunately the logic:
Has resolved and since we don't create
_dbt_max_partition
until later, we error at that introspection query.The text was updated successfully, but these errors were encountered: