Skip to content

✨ Add support for SQLAlchemy polymorphic models #1226

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

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6d93a46
support sqlalchemy polymorphic
Nov 26, 2024
589237b
improve docs
Nov 26, 2024
4071b0f
fix polymorphic_on check
Nov 26, 2024
48f2a88
fix polymorphic_on check
Nov 26, 2024
e6ad74d
fix lint
Nov 26, 2024
277953a
fix pydantic v1 support
Nov 26, 2024
4aade03
fix type hint for <3.10
Nov 26, 2024
a3044bb
add needs_pydanticv2 mark to test
Nov 26, 2024
015601c
improve code structure
Dec 3, 2024
66c1d93
lint
Dec 3, 2024
0efd1bf
remove effort of pydantic v1
Dec 3, 2024
7173b44
Merge branch 'main' into sqlalchemy_polymorphic_support
PaleNeutron Dec 10, 2024
84d739e
Update sqlmodel/_compat.py
PaleNeutron Dec 12, 2024
dbd0101
fix default value is InstrumentedAttribute in inherit
Feb 5, 2025
88670a5
Merge branch 'sqlalchemy_polymorphic_support' of https://github.com/P…
Feb 5, 2025
b1ed8c3
fix inherit order
Feb 5, 2025
5d1bf5c
support python < 3.9
Feb 5, 2025
ccbb92a
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
pre-commit-ci[bot] Feb 5, 2025
d0d0288
skip polymorphic in pydantic v1
Feb 5, 2025
525373d
Merge branch 'sqlalchemy_polymorphic_support' of https://github.com/P…
Feb 5, 2025
ab965f0
Merge branch 'main' into sqlalchemy_polymorphic_support
PaleNeutron Feb 5, 2025
68963e7
Merge branch 'main' into sqlalchemy_polymorphic_support
svlandeg Feb 20, 2025
95c6a1e
Merge branch 'main' into sqlalchemy_polymorphic_support
svlandeg Feb 24, 2025
c1dff79
disable pydantic warning during polymorphic
Mar 12, 2025
7d333fe
fix relationship problem of parent class during polymorphic inherit
May 15, 2025
32ebd6f
avoid add ClassVar multiple times
May 15, 2025
64f774f
Add support for polymorphic_abstract
May 27, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix type hint for <3.10
  • Loading branch information
John Lyu committed Nov 26, 2024
commit 4aade030813383d6f81a4173a3357dd4dd0e6349
2 changes: 1 addition & 1 deletion sqlmodel/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ def get_sqlalchemy_type(field: Any) -> Any:
raise ValueError(f"{type_} has no matching SQLAlchemy type")


def get_column_from_field(field: Any) -> Column | MappedColumn: # type: ignore
def get_column_from_field(field: Any) -> Union[Column, MappedColumn]: # type: ignore
if IS_PYDANTIC_V2:
field_info = field
else:
Expand Down