[BQ] Fix insert_overwrite with int + ts partitions #3098
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #3063
fixes #3095
Description
In v0.19.0, we added a
granularity
property of BigQuery partitioned tables. We wrote a general-purpose approach that leveraged the data type +_trunc
functions:https://github.com/fishtown-analytics/dbt/blob/2aa10fb1ed9f012cebb89cd6921b0c124a35aec8/plugins/bigquery/dbt/adapters/bigquery/impl.py#L65
Very cool! Unfortunately, it broke the "dynamic"
insert_overwrite
incremental strategy with integer- and timestamp-partitioned tables, and we didn't have nearly the automated testing we should have forinsert_overwrite
given how many community members are using it.This PR:
int64
-type partitions, to avoid writing a (make-believe)int64_trunc
functioninsert_overwrite
+ each possible partition type, as well as one case of the staticpartitions
-based approach. For some reason, the old tests (022_bigquery_test/test_scripting.py
) just was not running CI! I renamed totest_incremental_strategies.py
, which better reflects the set of possibilities.After merging, I plan to cherry-pick the commit onto
0.19.latest
.Checklist
CHANGELOG.md
and added information about my change to the "dbt next" section.