@@ -477,7 +477,7 @@ def Relationship(
477477class SQLModelMetaclass (ModelMetaclass , DeclarativeMeta ):
478478 __sqlmodel_relationships__ : Dict [str , RelationshipInfo ]
479479 model_config : SQLModelConfig
480- model_fields : Dict [str , FieldInfo ] # type: ignore[assignment ]
480+ model_fields : ClassVar [ Dict [str , FieldInfo ]]
481481 __config__ : Type [SQLModelConfig ]
482482 __fields__ : Dict [str , ModelField ] # type: ignore[assignment]
483483
@@ -839,7 +839,7 @@ def __tablename__(cls) -> str:
839839 return cls .__name__ .lower ()
840840
841841 @classmethod
842- def model_validate (
842+ def model_validate ( # type: ignore[override]
843843 cls : Type [_TSQLModel ],
844844 obj : Any ,
845845 * ,
@@ -863,20 +863,25 @@ def model_dump(
863863 mode : Union [Literal ["json" , "python" ], str ] = "python" ,
864864 include : Union [IncEx , None ] = None ,
865865 exclude : Union [IncEx , None ] = None ,
866- context : Union [Dict [ str , Any ] , None ] = None ,
867- by_alias : bool = False ,
866+ context : Union [Any , None ] = None ,
867+ by_alias : Union [ bool , None ] = None ,
868868 exclude_unset : bool = False ,
869869 exclude_defaults : bool = False ,
870870 exclude_none : bool = False ,
871871 round_trip : bool = False ,
872872 warnings : Union [bool , Literal ["none" , "warn" , "error" ]] = True ,
873+ fallback : Union [Callable [[Any ], Any ], None ] = None ,
873874 serialize_as_any : bool = False ,
874875 ) -> Dict [str , Any ]:
876+ if PYDANTIC_MINOR_VERSION < (2 , 11 ):
877+ by_alias = by_alias or False
875878 if PYDANTIC_MINOR_VERSION >= (2 , 7 ):
876879 extra_kwargs : Dict [str , Any ] = {
877880 "context" : context ,
878881 "serialize_as_any" : serialize_as_any ,
879882 }
883+ if PYDANTIC_MINOR_VERSION >= (2 , 11 ):
884+ extra_kwargs ["fallback" ] = fallback
880885 else :
881886 extra_kwargs = {}
882887 if IS_PYDANTIC_V2 :
@@ -896,7 +901,7 @@ def model_dump(
896901 return super ().dict (
897902 include = include ,
898903 exclude = exclude ,
899- by_alias = by_alias ,
904+ by_alias = by_alias or False ,
900905 exclude_unset = exclude_unset ,
901906 exclude_defaults = exclude_defaults ,
902907 exclude_none = exclude_none ,
0 commit comments