]> git.ipfire.org Git - thirdparty/fastapi/sqlmodel.git/commitdiff
Update main.py
authorMaruo <43961566+maru0123-2004@users.noreply.github.com>
Thu, 6 Oct 2022 02:35:02 +0000 (11:35 +0900)
committerGitHub <noreply@github.com>
Thu, 6 Oct 2022 02:35:02 +0000 (11:35 +0900)
sqlmodel/main.py

index de097968550f2990b7f9a508f6ca8d122b0a27ad..063d670306e59230f3ec12eb8a133806f390f82e 100644 (file)
@@ -376,8 +376,8 @@ class SQLModelMetaclass(ModelMetaclass, DeclarativeMeta):
 
 
 def get_sqlachemy_type(field: ModelField) -> Any:
-    if "sa_type" in field.field_info.extra:
-        return field.field_info.extra["sa_type"]
+    if not issubclass(type(field.field_info.sa_type), type(Undefined)):
+        return field.field_info.sa_type
     if issubclass(field.type_, str):
         if field.field_info.max_length:
             return AutoString(length=field.field_info.max_length)