FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

✨ Add support for all `Field` parameters from Pydantic `1.9.0` and above, make Pydantic `1.9.0` the minimum required version by daniil-berg · Pull Request #440 · fastapi/sqlmodel · GitHub

Repository navigation

✨ Add support for all Field parameters from Pydantic 1.9.0 and above, make Pydantic 1.9.0 the minimum required version - #440

Merged
tiangolo merged 6 commits into
fastapi:mainfrom
daniil-berg:pydantic-1.9.0-field-params
Oct 26, 2023
Merged

tiangolo merged 6 commits into
fastapi:mainfrom
daniil-berg:pydantic-1.9.0-field-params

Conversation

Copy link
Copy Markdown
Contributor

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 version 1.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

(incl. `max_digits`, `decimal_places`, `unique_items`, `discriminator`, and `repr`);
add tests for Pydantic capabilities;
bump Pydantic dependency to `1.9.0`

codecov Bot commented Sep 7, 2022 •
edited
Loading

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ea79c47) 98.49% compared to head (57e05ab) 97.81%.
Report is 94 commits behind head on main.

❗ Current head 57e05ab differs from pull request most recent head 8bc6450. Consider uploading reports for the commit 8bc6450 to get more accurate results

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     
Files Coverage Δ
sqlmodel/main.py 85.50% <100.00%> (ø)
tests/test_pydantic/test_field.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

github-actions Bot commented Sep 7, 2022

Copy link
Copy Markdown
Contributor

📝 Docs preview for commit 6728c25 at: https://63186d6a24607c220a2e25b4--sqlmodel.netlify.app

github-actions Bot commented Sep 7, 2022

Copy link
Copy Markdown
Contributor

📝 Docs preview for commit 57e05ab at: https://63187ebf24607c32762e235c--sqlmodel.netlify.app

Copy link
Copy Markdown
Contributor

📝 Docs preview for commit 45d5eb1 at: https://639ce0c089c20f00aba4cd75--sqlmodel.netlify.app

Copy link
Copy Markdown

@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).
It could really make our lives way better as devs using SQLModel.

Thanks

pajowu commented Mar 14, 2023

Copy link
Copy Markdown

@tiangolo any update on this?

N-Demir commented Sep 28, 2023

Copy link
Copy Markdown

++ on updates

tiangolo added the feature New feature or request label Oct 22, 2023

Copy link
Copy Markdown
Contributor

📝 Docs preview for commit 5ff6d2a at: https://de370077.sqlmodel.pages.dev

tiangolo changed the title ✨ Add support for all Field parameters from Pydantic version 1.9.0 ✨ Add support for all Field parameters from Pydantic 1.9.0 and above, make Pydantic 1.9.0 the minimum required version Oct 26, 2023

Copy link
Copy Markdown
Member

Awesome, thank you @daniil-berg! 🚀

This will be available in the next version: 0.0.10 🎉

Comment thread tests/test_pydantic/test_field.py Outdated
with pytest.raises(ValidationError):
Model(unique_strings=["x", "y", "x"])


Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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 ;-)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yep, the plan is to support SQLAlchemy 2.0 and Pydantic 2.0 as soon as possible. 🤓

tiangolo mentioned this pull request Nov 2, 2023
4 of 9 tasks
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL