-
-
Notifications
You must be signed in to change notification settings - Fork 64
fix: recursively convert nested dicts in model_from_dict #637
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40b5c3d to
f7be7cf
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #637 +/- ##
==========================================
+ Coverage 80.86% 80.92% +0.05%
==========================================
Files 94 94
Lines 6957 6977 +20
Branches 903 910 +7
==========================================
+ Hits 5626 5646 +20
Misses 1042 1042
Partials 289 289 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Harshal6927
reviewed
Dec 15, 2025
cofin
commented
Dec 15, 2025
3e0666d to
769377a
Compare
Harshal6927
approved these changes
Dec 19, 2025
769377a to
5cd8cec
Compare
JacobCoffee
approved these changes
Dec 21, 2025
3943ddb to
7f98984
Compare
…_dict Fixed regression where service.create() failed when passing nested dictionaries for relationship data. The model_from_dict() function now uses SQLAlchemy's class_mapper to detect relationships and recursively converts nested dicts to model instances. Changes: - Add _convert_relationship_value() helper function - Modify model_from_dict() to detect RelationshipProperty attributes - Handle one-to-one, one-to-many, and many-to-many relationships - Preserve existing model instances in mixed lists - Add 17 comprehensive unit tests for nested dict handling
Signed-off-by: Cody Fincher <204685+cofin@users.noreply.github.com>
Co-authored-by: Jacob Coffee <jacob@z7x.org> Signed-off-by: Cody Fincher <204685+cofin@users.noreply.github.com>
7f98984 to
232acf1
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #556 - Regression where
service.create()failed when passing nested dictionaries for relationship data.Changes
_convert_relationship_value()helper function to handle relationship conversionmodel_from_dict()to detectRelationshipPropertyattributes using SQLAlchemy'sclass_mapperExample Usage
Tests Added
Test plan
_sync.pyfiles