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

Enable serialization context #10094

Merged
merged 6 commits into from
May 7, 2024
Merged

Enable serialization context #10094

merged 6 commits into from
May 7, 2024

Conversation

gshank
Copy link
Contributor

@gshank gshank commented May 6, 2024

resolves #10093

Problem

We want to be able to serialize differently in different places.

Solution

Enable mashumaro serialization context feature.

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 May 6, 2024 18:57
@cla-bot cla-bot bot added the cla:yes label May 6, 2024
@gshank gshank marked this pull request as draft May 6, 2024 18:57
Copy link

codecov bot commented May 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.18%. Comparing base (3e8f2f1) to head (b69f071).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10094      +/-   ##
==========================================
- Coverage   88.21%   88.18%   -0.04%     
==========================================
  Files         181      181              
  Lines       22748    22771      +23     
==========================================
+ Hits        20068    20081      +13     
- Misses       2680     2690      +10     
Flag Coverage Δ
integration 85.49% <100.00%> (-0.12%) ⬇️
unit 62.66% <86.04%> (+0.02%) ⬆️

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.

@gshank gshank added the artifact_minor_upgrade To bypass the CI check by confirming that the change is not breaking label May 6, 2024
@gshank gshank marked this pull request as ready for review May 7, 2024 14:25

def __post_serialize__(self, dct: Dict, context: Optional[Dict] = None):
dct = super().__post_serialize__(dct, context)
if context and context.get("artifact") and "defer_relation" in dct:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this strictly a refactor or would we be starting to include the defer_relation in the programmatic response from dbtRunner invocations with this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This just maintains current functionality, which is that when generating artifacts we remove "defer_relation" and "call_config_dict" from all nodes. We could easily change it now if we want, but in order to minimize disruption I went with preserving the way it currently works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both of those are included in the msgpack versions (for internal use/partial parsing)

@gshank gshank merged commit 760e4ce into main May 7, 2024
63 checks passed
@gshank gshank deleted the enable_serialization_context branch May 7, 2024 21:17
Copy link
Contributor

github-actions bot commented May 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-10094-to-1.8.latest
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 760e4cea3a36b428fc0e66148ab87f10b971ad06
# Push it to GitHub
git push --set-upstream origin backport-10094-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-10094-to-1.8.latest.

QMalcolm pushed a commit that referenced this pull request May 8, 2024
* Update __post_serialize__ signatures

* Temporarily linke dbt-common and dbt-adapters branches

* Changie

* Move fields not in artifacts to resource __post_serialize__ methods

* remove defer_relation in snapshots

* Remove references to branch changes
gshank added a commit that referenced this pull request May 8, 2024
* Update __post_serialize__ signatures

* Temporarily linke dbt-common and dbt-adapters branches

* Changie

* Move fields not in artifacts to resource __post_serialize__ methods

* remove defer_relation in snapshots

* Remove references to branch changes
QMalcolm added a commit that referenced this pull request May 8, 2024
* Update __post_serialize__ signatures

* Temporarily linke dbt-common and dbt-adapters branches

* Changie

* Move fields not in artifacts to resource __post_serialize__ methods

* remove defer_relation in snapshots

* Remove references to branch changes

Co-authored-by: Gerda Shank <[email protected]>
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 backport 1.8.latest cla:yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable contexts for serialization
3 participants