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

Co-authored-by: Mohamed Farahat <farahats9@yahoo.com>
Co-authored-by: Stefan Borer <stefan.borer@gmail.com>
Co-authored-by: Peter Landry <peter.landry@gmail.com>
Co-authored-by: Anton De Meester <antondemeester+github@gmail.com>
This commit is contained in:
Sebastián Ramírez
2023-12-04 15:42:39 +01:00
committed by GitHub
parent 5b733b348d
commit fa2f178b8a
79 changed files with 2614 additions and 517 deletions

View File

@@ -1,5 +1,6 @@
from typing import Optional
import pytest
from sqlmodel import Field, Session, SQLModel, create_engine
@@ -21,6 +22,7 @@ def test_query(clear_sqlmodel):
session.refresh(hero_1)
with Session(engine) as session:
query_hero = session.query(Hero).first()
with pytest.warns(DeprecationWarning):
query_hero = session.query(Hero).first()
assert query_hero
assert query_hero.name == hero_1.name