-
-
Notifications
You must be signed in to change notification settings - Fork 679
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 support for all Field
parameters from Pydantic 1.9.0
and above, make Pydantic 1.9.0
the minimum required version
#440
✨ Add support for all Field
parameters from Pydantic 1.9.0
and above, make Pydantic 1.9.0
the minimum required version
#440
Conversation
(incl. `max_digits`, `decimal_places`, `unique_items`, `discriminator`, and `repr`); add tests for Pydantic capabilities; bump Pydantic dependency to `1.9.0`
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #440 +/- ##
==========================================
- Coverage 98.49% 97.81% -0.69%
==========================================
Files 185 188 +3
Lines 5856 6315 +459
==========================================
+ Hits 5768 6177 +409
- Misses 88 138 +50
☔ View full report in Codecov by Sentry. |
📝 Docs preview for commit 6728c25 at: https://63186d6a24607c220a2e25b4--sqlmodel.netlify.app |
📝 Docs preview for commit 57e05ab at: https://63187ebf24607c32762e235c--sqlmodel.netlify.app |
📝 Docs preview for commit 45d5eb1 at: https://639ce0c089c20f00aba4cd75--sqlmodel.netlify.app |
@tiangolo Is there any planned timeline to merge this PR? Discriminator is a need for many developers (that's why pydantic released a support for it). Thanks |
@tiangolo any update on this? |
++ on updates |
📝 Docs preview for commit 5ff6d2a at: https://de370077.sqlmodel.pages.dev |
Field
parameters from Pydantic version 1.9.0
Field
parameters from Pydantic 1.9.0
and above, make Pydantic 1.9.0
the minimum required version
Awesome, thank you @daniil-berg! 🚀 This will be available in the next version: |
with pytest.raises(ValidationError): | ||
Model(unique_strings=["x", "y", "x"]) | ||
|
||
|
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.
why remove and not skipif, as pydantic v2 support is not present now?
Please note that if that means Pydantic v2 support in few days, I'm fine with it ;-)
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.
Yep, the plan is to support SQLAlchemy 2.0 and Pydantic 2.0 as soon as possible. 🤓
Summary
The proposed changes add support for the following
Field
parameters:max_digits
decimal_places
unique_items
discriminator
repr
This makes the SQLModel
Field
constructor support all Pydantic field parameters as of version1.9.0
up until the current one (1.10.2
).Tests sub-package for Pydantic capabilities was added and tests for the new field parameters were included.
The Pydantic dependency was bumped to
1.9.0
.Fixes