[Bug] Snapshot in new_record
mode will add redundant entries for deleted records already flagged as deleted
#654
Labels
feature:snapshots
Issues related to the snapshot materialization
pkg:dbt-bigquery
Issue affects dbt-bigquery
Is this a new bug?
Which packages are affected?
Current Behavior
Snapshots using the
new_record
method for hard deletes will insert redundant entries on each execution for records already flagged withis_deleted
asTrue
.The screenshot below demonstrates the effect of running the
dbt snapshot
multiple times, without any changes in the source table, and the many redundant records inserted. The records have the sameunique_identifier
value.Expected Behavior
One entry should be inserted upon the first time the record in the source is deleted. Subsequent snapshot runs should not insert new entries for records already marked with
is_deleted
True
.The expected result would be only 2 entries: initially with
is_deleted
asFalse
and only a single entry withis_deleted
asTrue
no matter how many times thedbt snapshot
command is run on top of the same source data.Steps To Reproduce
new_record
mode for hard deletesRelevant log output
Environment
Additional Context
I identified the root cause of the problem and submitted a PR #655 with a fix. I used this recently merged PR as reference #385
The text was updated successfully, but these errors were encountered: