Skip to content

Commit b23a457

Browse files
committed
add fallback arg for Pydantic 2.11 and above
1 parent 07f3269 commit b23a457

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sqlmodel/main.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -871,15 +871,18 @@ def model_dump(
871871
exclude_none: bool = False,
872872
round_trip: bool = False,
873873
warnings: Union[bool, Literal["none", "warn", "error"]] = True,
874-
fallback: Union[Callable[[Any], Any], None] = None,
875874
serialize_as_any: bool = False,
875+
**kwargs: Any,
876876
) -> Dict[str, Any]:
877+
fallback = kwargs.get("fallback", None)
877878
if PYDANTIC_MINOR_VERSION >= (2, 7):
878879
extra_kwargs: Dict[str, Any] = {
879880
"context": context,
880881
"serialize_as_any": serialize_as_any,
881-
"fallback": fallback,
882882
}
883+
if PYDANTIC_MINOR_VERSION >= (2, 11):
884+
extra_kwargs["fallback"] = fallback
885+
883886
else:
884887
extra_kwargs = {}
885888
if IS_PYDANTIC_V2:

0 commit comments

Comments
 (0)