Closed ajsquared closed 3 months ago
If it's relevant this model is using the insert_overwrite
strategy
Per my comment on your other ticket, it's possible this is a function of us incorrectly detecting the previously existing table. Please let me know if 1.8.2rc1 fixes your issue, and if I not, email me a relevant dbt.log file.
Since the --full-refresh flag was specified, I would expect it to recreate the table in full, so the existing column types should not be relevant. Based on https://docs.getdbt.com/docs/build/incremental-models#how-do-i-rebuild-an-incremental-model, I'd expect DBT to drop the existing table first, though even if that doesn't happen the current state should not be relevant.
Some context on this - since it's a delta table, our default is to use create or replace
. I'll need to think on how to handle this.
I've done some more testing on this one, and I think there's not actually a bug here. I found we had some incorrect deployments and the model definition was out of sync with the contract defined in the YAML file. I was not able to reproduce this failure mode, and column types did update correctly.
I'll close this one unless I can find another case where this behaves incorrectly.
Describe the bug
When trying to backfill an incremental model with
--full-refresh
, the backfill fails if column types change.Steps To Reproduce
We created an incremental model and had it running in production for some time. We wanted to change the type of two columns in this model from
int
todouble
. In doing so, we wanted to backfill the entire table using the--full-refresh
flag. We ran DBT withThis failed with
We do have contract.enforced set to true in the config for this model.
Expected behavior
Since the
--full-refresh
flag was specified, I would expect it to recreate the table in full, so the existing column types should not be relevant. Based on https://docs.getdbt.com/docs/build/incremental-models#how-do-i-rebuild-an-incremental-model, I'd expect DBT to drop the existing table first, though even if that doesn't happen the current state should not be relevant.System information
The output of
dbt --version
:The operating system you're using: Linux
The output of
python --version
:Python 3.11.7
Additional context
This is on a Databricks shared cluster running DBR 14.3