We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9d0b8b6 commit bdfb072Copy full SHA for bdfb072
sqlmodel/_compat.py
@@ -18,6 +18,7 @@
18
Union,
19
)
20
21
+from annotated_types import MaxLen
22
from pydantic import VERSION as PYDANTIC_VERSION
23
from pydantic import BaseModel
24
from pydantic.fields import FieldInfo
@@ -201,6 +202,10 @@ def get_field_metadata(field: Any) -> Any:
201
202
for meta in field.metadata:
203
if isinstance(meta, PydanticMetadata):
204
return meta
205
+ elif isinstance(meta, MaxLen):
206
+ fake = FakeMetadata()
207
+ fake.max_length = meta.max_length
208
+ return fake
209
return FakeMetadata()
210
211
def post_init_field_info(field_info: FieldInfo) -> None:
0 commit comments