-
-
Notifications
You must be signed in to change notification settings - Fork 783
✨ Support SQLAlchemy keyed dict models with Pydantic v2 #1287
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
base: main
Are you sure you want to change the base?
✨ Support SQLAlchemy keyed dict models with Pydantic v2 #1287
Conversation
|
Thanks, @svlandeg! |
|
Any update on this? This is a great feature add that I need. For now, I'm setting the requirement to use git at this PR. |
|
@svlandeg what is the next step in the process? How do I get this to be reviewed? (Thanks!) |
|
Hi @nkrishnaswami! It's in our review queue, so not much to be done by you at this point in time. We'll get back to you once we've had time to go through this in details 🙏 |
saky-semicolon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good addition — the change in _compat.py improves handling of dict annotations, and the new test (test_attribute_keyed_dict.py) clearly validates the functionality with attribute_keyed_dict.
YuriiMotov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
We should probably re-export sqlalchemy.orm.collections
Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
c7c1402 to
a801312
Compare
YuriiMotov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkrishnaswami, thank you!
Could you please address my review comments?
Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
YuriiMotov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@nkrishnaswami, thank you!
|
YW, and thanks for reviewing it! |
To add support for SQLAlchemy mapped collections, I'd like to add a case for
dictorigins to the Pydantic v2get_relationship_toimplementation. This PR does so, with a test case using a dictionary with collection classattribute_keyed_dict.