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

[state:modified] store unrendered_database and unrendered_schema on source definition for state:modified comparisons #10675

Merged
merged 42 commits into from
Sep 30, 2024

Conversation

MichelleArk
Copy link
Contributor

@MichelleArk MichelleArk commented Sep 6, 2024

Resolves #9573

Problem

source definitions in schema yaml files often include jinja in the database and schema properties.

However, this makes them sensitive to environment in that the env var/var/jinja resolution may change between runs without the actual source changing, leading to false positives.

Solution

Start persisting unrendered_database and unrendered_schema during source parsing, and do comparison on unrendered values during state:modified, behind state_modified_compare_more_unrendered_values behaviour flag.

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.

@cla-bot cla-bot bot added the cla:yes label Sep 6, 2024
Copy link
Contributor

github-actions bot commented Sep 6, 2024

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 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.17%. Comparing base (d1857b3) to head (1261b29).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10675      +/-   ##
==========================================
+ Coverage   89.15%   89.17%   +0.01%     
==========================================
  Files         183      183              
  Lines       23344    23380      +36     
==========================================
+ Hits        20812    20848      +36     
  Misses       2532     2532              
Flag Coverage Δ
integration 86.40% <100.00%> (+0.02%) ⬆️
unit 62.18% <67.56%> (+<0.01%) ⬆️

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

Components Coverage Δ
Unit Tests 62.18% <67.56%> (+<0.01%) ⬆️
Integration Tests 86.40% <100.00%> (+0.02%) ⬆️

@MichelleArk MichelleArk changed the title store unrendered database on source definition state:modified: store unrendered database on source definition Sep 25, 2024
@MichelleArk MichelleArk changed the title state:modified: store unrendered database on source definition [state:modified] store unrendered database on source definition Sep 25, 2024
@MichelleArk MichelleArk added the artifact_minor_upgrade To bypass the CI check by confirming that the change is not breaking label Sep 26, 2024
@MichelleArk MichelleArk changed the title [state:modified] store unrendered database on source definition [state:modified] store unrendered_database and unrendered_schema on source definition for state:modified comparisons Sep 26, 2024
Base automatically changed from state-modified-source-tests to main September 26, 2024 15:03
@MichelleArk
Copy link
Contributor Author

Associated schemas.getdbt.com PR: dbt-labs/schemas.getdbt.com#63

@MichelleArk
Copy link
Contributor Author

Sorry about the messy commit history, I think it's a GH issue from when the base was changed from #10487 to main. The changed files and contents all look correct though.

@MichelleArk MichelleArk marked this pull request as ready for review September 30, 2024 14:53
@MichelleArk MichelleArk requested review from a team as code owners September 30, 2024 14:53
@MichelleArk MichelleArk requested review from jzhu13 and removed request for a team September 30, 2024 14:53
@MichelleArk MichelleArk merged commit a86e2b4 into main Sep 30, 2024
67 of 68 checks passed
@MichelleArk MichelleArk deleted the state-modified-source-unrendered-database branch September 30, 2024 15:50
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
Projects
None yet
2 participants