We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ce968ea commit e522d9dCopy full SHA for e522d9d
sqlmodel/main.py
@@ -39,6 +39,7 @@
39
Numeric,
40
inspect,
41
)
42
+from sqlalchemy import types as sa_types
43
from sqlalchemy import Enum as sa_Enum
44
from sqlalchemy.orm import (
45
Mapped,
@@ -656,6 +657,10 @@ def get_sqlalchemy_type(field: Any) -> Any:
656
657
type_ = get_sa_type_from_field(field)
658
metadata = get_field_metadata(field)
659
660
+ # If it's already an SQLAlchemy type (eg. AutoString), use it directly
661
+ if isinstance(type_, type) and issubclass(type_, sa_types.TypeEngine):
662
+ return type_
663
+
664
# Checks for `Literal` type annotation
665
if type_ is Literal:
666
return AutoString
0 commit comments