[Bug] Updating partitioning/clustering on a table self referencing itself will fail and delete the table #1270
Closed
2 tasks done
Labels
enhancement
New feature or request
Is this a new bug in dbt-bigquery?
Current Behavior
In some cases, models can be designed to self reference itself (
{{ this }}
) as part of a "sliding window" approach.Running that kind model AFTER adding a change to clustering/partitioning results in triggering:
dbt-bigquery/dbt/include/bigquery/macros/materializations/table.sql
Lines 27 to 30 in 0627aa2
dbt will drop your current "state" and your query will fail (because
{{ this }}
won't exist).If you add an
is_incremental
backup it might backfire as you would recreate the table "from scratch" without previous state making it a "silent" bug.It would happen both in
table
andincremental
materializationExpected Behavior
This code is still relevant as trying to reproduce the root cause would still throw something like:
I would suggest to:
Steps To Reproduce
A simple example would be to use following model:
Run the model.
Then you are adding a config block to
cluster_by = ['website']
.Rerun the model.
Relevant log output
No response
Environment
Additional Context
That bug is some unexpected "chaos engineering" that's not so easy to figure out
The text was updated successfully, but these errors were encountered: