File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 2525 overload ,
2626)
2727
28- from pydantic import BaseModel , EmailStr
28+ from pydantic import (
29+ AwareDatetime ,
30+ BaseModel ,
31+ EmailStr ,
32+ FutureDate ,
33+ FutureDatetime ,
34+ NaiveDatetime ,
35+ PastDate ,
36+ PastDatetime ,
37+ )
2938from pydantic .fields import FieldInfo as PydanticFieldInfo
3039from sqlalchemy import (
3140 Boolean ,
@@ -680,14 +689,18 @@ def get_sqlalchemy_type(field: Any) -> Any:
680689 return Boolean
681690 if issubclass (type_ , int ):
682691 return Integer
683- if issubclass (type_ , datetime ):
692+ if issubclass (type_ , ( datetime , FutureDatetime , PastDatetime ) ):
684693 return DateTime
685- if issubclass (type_ , date ):
694+ if issubclass (type_ , ( date , FutureDate , PastDate ) ):
686695 return Date
687696 if issubclass (type_ , timedelta ):
688697 return Interval
689698 if issubclass (type_ , time ):
690699 return Time
700+ if issubclass (type_ , AwareDatetime ):
701+ return DateTime (timezone = True )
702+ if issubclass (type_ , NaiveDatetime ):
703+ return DateTime (timezone = False )
691704 if issubclass (type_ , bytes ):
692705 return LargeBinary
693706 if issubclass (type_ , Decimal ):
You can’t perform that action at this time.
0 commit comments