Skip to content

Commit bda621a

Browse files
committed
💚 Add exclude_computed_fields from pydantic 2.12
+ match the upstream interface to avoid mypy linting warning. + pydantic added exclude_computed_fields in pydantic/pydantic-core#1780
1 parent c9765b3 commit bda621a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sqlmodel/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,7 @@ def model_dump(
869869
exclude_unset: bool = False,
870870
exclude_defaults: bool = False,
871871
exclude_none: bool = False,
872+
exclude_computed_fields: bool = False, # v2.12
872873
round_trip: bool = False,
873874
warnings: Union[bool, Literal["none", "warn", "error"]] = True,
874875
fallback: Union[Callable[[Any], Any], None] = None, # v2.11
@@ -882,6 +883,8 @@ def model_dump(
882883
extra_kwargs["serialize_as_any"] = serialize_as_any
883884
if PYDANTIC_MINOR_VERSION >= (2, 11):
884885
extra_kwargs["fallback"] = fallback
886+
if PYDANTIC_MINOR_VERSION >= (2, 12):
887+
extra_kwargs["exclude_computed_fields"] = exclude_computed_fields
885888
if IS_PYDANTIC_V2:
886889
return super().model_dump(
887890
mode=mode,

0 commit comments

Comments
 (0)