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

add pre_serialization method to BaseResource #9718

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

emmyoop
Copy link
Member

@emmyoop emmyoop commented Mar 1, 2024

resolves #9615

Problem

A subclass of a BaseResource should be able to make forward-compatible changes (adding a field or deleting a field with a default value) within any major version and have previous code successfully deserialize the payload.

Solution

Add __pre_deserialize__ on BaseResource.

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 Mar 1, 2024
Copy link
Contributor

github-actions bot commented Mar 1, 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.

@emmyoop emmyoop changed the title add pre_serialization method and tests add pre_serialization method to BaseResource Mar 1, 2024
Copy link

codecov bot commented Mar 1, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 88.08%. Comparing base (e4fe839) to head (7721035).

Files Patch % Lines
core/dbt/artifacts/resources/base.py 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9718      +/-   ##
==========================================
- Coverage   88.08%   88.08%   -0.01%     
==========================================
  Files         178      178              
  Lines       22433    22442       +9     
==========================================
+ Hits        19761    19767       +6     
- Misses       2672     2675       +3     
Flag Coverage Δ
integration 85.60% <90.00%> (-0.03%) ⬇️
unit 62.27% <90.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.

@emmyoop emmyoop added the artifact_minor_upgrade To bypass the CI check by confirming that the change is not breaking label Mar 1, 2024
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
1 participant