Allows snapshots to have a list as a unique key #182
Closed
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.
resolves #181
Problem
Currently the unique_key must be a string. It can be a column name or an expression. This PR changes it so it can be a list of column names or expressions.
Solution
This is modeled off of this PR: dbt-labs/dbt-core#4618
It checks if the unique_key is a list and modifies the code based on that. I am open to other approaches if we want something different (maybe turning a string unique_key into an array one element long?).
I couldn't find tests for the existing snapshot macros, so I'm also open to feedback on the best way to add tests for this feature. I have tested this by copying the macros to one of my dbt projects and running it with a modified version of dbt-core that allows a list for the unique_key.
Checklist