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

Decouple warn error options from core and adapters #9338

Merged

Conversation

MichelleArk
Copy link
Contributor

@MichelleArk MichelleArk commented Jan 4, 2024

resolves #9337

Problem

WarnErrorOptions is now defined in dbt/common, which is being moved to a separate upstream package/repo (dbt-common) shortly. It is defined in dbt/common because it is used both by dbt-common and dbt-core. Unfortunately, it depends on both dbt-core and dbt-adapter to import the event type module to validate items in its collection. This would represent a circular dependency once moved to a separate repo as dbt-common should be upstream to both dbt-adapter and dbt-core.

Solution

  • update WarnErrorOptions constructor to accept valid_error_names on instantiation, for use in validation
  • provide valid_error_names during WarnErrorOptions construction in dbt-core with ALL_EVENT_NAMES (combines adapter+common+core events)
  • moved test_helper_types unit tests to tests/common since helper_types is defined in common and only has dbt-common dependencies!

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

@cla-bot cla-bot bot added the cla:yes label Jan 4, 2024
Copy link

codecov bot commented Jan 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (11cc71b) 86.60% compared to head (08f31ef) 86.61%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9338      +/-   ##
==========================================
+ Coverage   86.60%   86.61%   +0.01%     
==========================================
  Files         224      225       +1     
  Lines       27004    27010       +6     
==========================================
+ Hits        23386    23395       +9     
+ Misses       3618     3615       -3     
Flag Coverage Δ
integration 83.50% <92.85%> (+0.01%) ⬆️
unit 65.22% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MichelleArk MichelleArk marked this pull request as ready for review January 5, 2024 14:59
@MichelleArk MichelleArk requested a review from a team as a code owner January 5, 2024 14:59
Copy link
Member

@emmyoop emmyoop left a comment

Choose a reason for hiding this comment

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

Looks good.

@MichelleArk MichelleArk merged commit 43136bb into main Jan 5, 2024
56 checks passed
@MichelleArk MichelleArk deleted the decouple-warn-error-options-from-core-and-adapters branch January 5, 2024 18:52
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.

[CT-3526] Remove import of dbt.adapters.events.types and dbt.events.types from dbt/common
3 participants