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

deprecations.buffer: respect --quiet and --warn-error-options for deprecations #10534

Merged
merged 4 commits into from
Aug 7, 2024

Conversation

MichelleArk
Copy link
Contributor

@MichelleArk MichelleArk commented Aug 6, 2024

Resolves #10105

Problem

new deprecations in dbt config parsing does not respect --quiet or --warn-error-options

Solution

provide a way to buffer deprecations, and fire them once flags are initialized

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.

🎩

❯ dbt parse
00:07:01  Running with dbt=1.9.0-a1
00:07:01  [WARNING]: Deprecated functionality

User config should be moved from the 'config' key in profiles.yml to the 'flags' key in dbt_project.yml.
00:07:01  target not specified in profile 'postgres', using 'default'
00:07:01  Registered adapter: postgres=1.9.0-a1
00:07:01  Performance info: /Users/michelleark/src/jaffle-shop/target/perf_info.json

❯ dbt --quiet parse

❯ dbt --warn-error-options "{'silence': ['ProjectFlagsMovedDeprecation']}" parse
00:07:39  Running with dbt=1.9.0-a1
00:07:39  target not specified in profile 'postgres', using 'default'
00:07:39  Registered adapter: postgres=1.9.0-a1
00:07:39  Performance info: /Users/michelleark/src/jaffle-shop/target/perf_info.json

❯ dbt --warn-error-options "{'include': ['ProjectFlagsMovedDeprecation']}" parse
00:07:52  Running with dbt=1.9.0-a1
00:07:52  Encountered an error:
Compilation Error
  [WARNING]: Deprecated functionality

  User config should be moved from the 'config' key in profiles.yml to the 'flags' key in dbt_project.yml.

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

github-actions bot commented Aug 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.

@dbt-labs dbt-labs deleted a comment from codecov bot Aug 7, 2024
@@ -355,6 +355,8 @@ def fire_deprecations(self):
# not get pickled when written to disk as json.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to refactor the deprecated_env_var_warnings mechanism above to use the new deprecations.buffer pattern but will defer that to a follow-up PR

@MichelleArk MichelleArk marked this pull request as ready for review August 7, 2024 00:22
@MichelleArk MichelleArk requested a review from a team as a code owner August 7, 2024 00:22
Copy link

codecov bot commented Aug 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.82%. Comparing base (21a4633) to head (fdcb0b1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10534      +/-   ##
==========================================
- Coverage   88.84%   88.82%   -0.02%     
==========================================
  Files         180      180              
  Lines       22717    22720       +3     
==========================================
- Hits        20182    20181       -1     
- Misses       2535     2539       +4     
Flag Coverage Δ
integration 86.05% <100.00%> (-0.02%) ⬇️
unit 62.35% <92.30%> (+0.03%) ⬆️

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

Components Coverage Δ
Unit Tests 62.35% <92.30%> (+0.03%) ⬆️
Integration Tests 86.05% <100.00%> (-0.02%) ⬇️

Copy link
Contributor

@gshank gshank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A nice neat solution!

@MichelleArk MichelleArk merged commit 1dd26e7 into main Aug 7, 2024
68 checks passed
@MichelleArk MichelleArk deleted the deprecations-buffer branch August 7, 2024 15:16
Copy link
Contributor

github-actions bot commented Aug 7, 2024

The backport to 1.8.latest failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.8.latest 1.8.latest
# Navigate to the new working tree
cd .worktrees/backport-1.8.latest
# Create a new branch
git switch --create backport-10534-to-1.8.latest
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 1dd26e79af721a5a3fc6ed8d464f9b4cb761ddad
# Push it to GitHub
git push --set-upstream origin backport-10534-to-1.8.latest
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.8.latest

Then, create a pull request where the base branch is 1.8.latest and the compare/head branch is backport-10534-to-1.8.latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Regression] dbt --quiet ls --output json should not print warnings in 1.6 and 1.7
3 participants