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

Modify snapshot config to allow using schema/database/alias macros #10439

Merged
merged 9 commits into from
Jul 18, 2024

Conversation

gshank
Copy link
Contributor

@gshank gshank commented Jul 12, 2024

resolves #10301

Problem

Snapshots are special snowflakes and use "target_schema" and "target_database" instead of standard schema/database/alias.

Solution

Do not require setting "target_schema" and instead use standard schema setting (unless target_schema or target_database is set, then override).

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/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 July 12, 2024 21:11
@cla-bot cla-bot bot added the cla:yes label Jul 12, 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 Jul 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.79%. Comparing base (1aeff2c) to head (6aeba99).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10439      +/-   ##
==========================================
- Coverage   88.79%   88.79%   -0.01%     
==========================================
  Files         180      180              
  Lines       22562    22549      -13     
==========================================
- Hits        20034    20022      -12     
+ Misses       2528     2527       -1     
Flag Coverage Δ
integration 86.06% <100.00%> (-0.01%) ⬇️
unit 62.17% <100.00%> (+0.07%) ⬆️

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

Components Coverage Δ
Unit Tests 62.17% <100.00%> (+0.07%) ⬆️
Integration Tests 86.06% <100.00%> (-0.01%) ⬇️

@gshank gshank added the artifact_minor_upgrade To bypass the CI check by confirming that the change is not breaking label Jul 13, 2024
@gshank gshank changed the title Tweak snapshot config to allow using schema/database/alias macros Modify snapshot config to allow using schema/database/alias macros Jul 15, 2024
@graciegoheen graciegoheen added the user docs [docs.getdbt.com] Needs better documentation label Jul 15, 2024
@graciegoheen
Copy link
Contributor

Confirmed everything is working as expected:

  1. I can create a snapshot without target_schema
    Screenshot 2024-07-18 at 1 12 09 PM
    Screenshot 2024-07-18 at 1 12 21 PM

  2. I can also create a snapshot with schema
    Screenshot 2024-07-18 at 1 13 28 PM
    Screenshot 2024-07-18 at 1 13 35 PM

  3. target_schema still works for backwards compatibility
    Screenshot 2024-07-18 at 1 14 07 PM
    Screenshot 2024-07-18 at 1 14 14 PM

@gshank gshank merged commit c668846 into main Jul 18, 2024
69 of 71 checks passed
@gshank gshank deleted the snapshots_schema_database branch July 18, 2024 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
artifact_minor_upgrade To bypass the CI check by confirming that the change is not breaking cla:yes user docs [docs.getdbt.com] Needs better documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Snapshots should respect generate schema/database name macro
3 participants