Skip to content

INTPYTHON-602 Fix loading of embedded model fields that use database converters #295

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

Merged
merged 1 commit into from
May 6, 2025

Conversation

timgraham
Copy link
Collaborator

@timgraham timgraham commented Apr 27, 2025

No description provided.

@timgraham timgraham marked this pull request as ready for review May 4, 2025 23:42
@timgraham timgraham requested a review from WaVEV May 4, 2025 23:42
return None
# Apply database converters to each field of the embedded model.
for field in self.embedded_model._meta.fields:
expression = Col("", field)
Copy link
Collaborator

Choose a reason for hiding this comment

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

🤔 I think an Expression(output_field=field) is a better approach, it is more minimalistic.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've amended this PR since the from_db_value() approach doesn't work for nested models.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't remain what the old code looks like. is It fixed now?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Reviewing the unit test, show that is working now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it. New converted is added that apply the needed converters.

WaVEV
WaVEV previously approved these changes May 5, 2025
@timgraham timgraham requested a review from WaVEV May 5, 2025 10:55
@timgraham timgraham dismissed WaVEV’s stale review May 5, 2025 17:56

new implementation

@timgraham timgraham merged commit 4633a9e into mongodb:main May 6, 2025
10 of 11 checks passed
@timgraham timgraham deleted the PY602 branch May 6, 2025 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants