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

✨ Add support for Pydantic v2 (while keeping support for v1 if v2 is not available), including initial work by AntonDeMeester by tiangolo · Pull Request #722 · fastapi/sqlmodel · GitHub

Repository navigation

✨ Add support for Pydantic v2 (while keeping support for v1 if v2 is not available), including initial work by AntonDeMeester - #722

Merged
tiangolo merged 109 commits into
mainfrom
pv2-c
Dec 4, 2023
Merged

tiangolo merged 109 commits into
mainfrom
pv2-c

Conversation

tiangolo commented Dec 4, 2023 •
edited
Loading

Copy link
Copy Markdown
Member

✨ Add support for Pydantic v2 (while keeping support for v1 if v2 is not available)

This includes the commits in the initial work by @AntonDeMeester in #699

  • I reverted some things, refactored some parts, fixed some hidden bugs.
  • Restructured the logic in compat.
  • Updated the methods to be available in both Pydantic v1 and v2.
  • Deprecated old methods (from_orm(), etc), adding deprecation markers (they show up in editors), and refactoring the code to use the new ones.
  • Update the docs to use .model_validate() instead of .from_orm() and .parse_obj().
  • Re-implemented several internal parts to support data updates in .model_validate() and keep compatibility with Pydantic v2 and v1, whichever is installed.
  • Implemented the necessary logic to allow keeping values without defaults without them.
  • Implemented the logic to support SQLAlchemy's custom init overriding while keeping support for non-SQLAlchemy models.
  • Updated all the necessary tests to be compatible with both Pydantic v2 and v1, minimizing the cases where its needed to have separate tests.

github-actions Bot commented Dec 4, 2023

Copy link
Copy Markdown
Contributor

📝 Docs preview for commit f1ab6a6 at: https://987b63e3.sqlmodel.pages.dev

github-actions Bot commented Dec 4, 2023

Copy link
Copy Markdown
Contributor

📝 Docs preview for commit 5f4d502 at: https://e043601e.sqlmodel.pages.dev

github-actions Bot commented Dec 4, 2023

Copy link
Copy Markdown
Contributor

📝 Docs preview for commit b3fcaf0 at: https://d531680f.sqlmodel.pages.dev

github-actions Bot commented Dec 4, 2023

Copy link
Copy Markdown
Contributor

📝 Docs preview for commit f121b00 at: https://31d1b17d.sqlmodel.pages.dev

tiangolo added the feature New feature or request label Dec 4, 2023
tiangolo marked this pull request as ready for review December 4, 2023 14:41
tiangolo merged commit fa2f178 into main Dec 4, 2023
tiangolo deleted the pv2-c branch December 4, 2023 14:42

Copy link
Copy Markdown

Oh sweet!!

Copy link
Copy Markdown
Contributor

Really amazing news, thanks for all the work that went into this!

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