Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple unique keys in snapshots #10795

Merged
merged 12 commits into from
Oct 22, 2024
Merged

Conversation

gshank
Copy link
Contributor

@gshank gshank commented Sep 30, 2024

Resolves #9992

Problem

Users may want to snapshot tables with multiple unique keys.

Solution

Redefine the SnapshotConfig unique_key attribute as a Optional[Union[str, List[str]]]. Supporting code in dbt-adapters.

Checklist

  • I have read the contributing guide and understand what's expected of me.
  • I have run this code in development, and it appears to resolve the stated issue.
  • This PR includes tests, or tests are not required or relevant for this PR.
  • This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.
  • This PR includes type annotations for new and modified functions.

@gshank gshank requested a review from a team as a code owner September 30, 2024 15:13
@cla-bot cla-bot bot added the cla:yes label Sep 30, 2024
Copy link
Contributor

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

Copy link

codecov bot commented Sep 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.13%. Comparing base (3d96b4e) to head (885d9b4).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10795      +/-   ##
==========================================
- Coverage   89.15%   89.13%   -0.02%     
==========================================
  Files         183      183              
  Lines       23443    23443              
==========================================
- Hits        20901    20897       -4     
- Misses       2542     2546       +4     
Flag Coverage Δ
integration 86.42% <100.00%> (-0.02%) ⬇️
unit 62.12% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Unit Tests 62.12% <100.00%> (ø)
Integration Tests 86.42% <100.00%> (-0.02%) ⬇️

@gshank gshank closed this Oct 1, 2024
@gshank gshank reopened this Oct 1, 2024
@gshank gshank requested a review from a team as a code owner October 1, 2024 18:00
@gshank gshank requested review from wpowers-dbt and removed request for a team October 1, 2024 18:00
@gshank gshank closed this Oct 1, 2024
@gshank gshank reopened this Oct 1, 2024
@gshank gshank merged commit f7b7935 into main Oct 22, 2024
58 of 60 checks passed
@gshank gshank deleted the multiple-snapshot-unique-keys branch October 22, 2024 18:47
QMalcolm added a commit to dbt-labs/schemas.getdbt.com that referenced this pull request Oct 23, 2024
QMalcolm added a commit to dbt-labs/schemas.getdbt.com that referenced this pull request Oct 23, 2024
* Update default `lookback` value in v12 manifest

* Add snapshot changes from dbt-labs/dbt-core#10795
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Allows snapshots to have a list as a unique key
2 participants