Incremental Refreshes - Unique Key Behavior with Delete+Insert Strategy? #9318
Unanswered
james-larsen
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Can someone help me better understand how dbt works with its unique keys when using a delete+insert strategy? My use case is to recalculate one record per customer per day for the next 7 days based on a number of factors. So technically, the unique key is customer ID and calendar date. However, during any given refresh, which customers are eligible to have a day calculated for them could change, and customers could drop off. If dbt works the way I hope it does, if I specify only calendar date as the unique key, I want it to determine the unique calendar dates in my incremental dataset, delete from the main dataset all matching dates, then insert the new customer / date records. This clearly would wreak havoc with a merge strategy, but I just want to confirm in this circumstance that providing only half the PK as a unique key isn't going to cause any weird behavior with the delete+insert strategy. Any insight would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions