Skip to content

Commit 4213c97

Browse files
committed
support AnyURL
1 parent cb6ccf4 commit 4213c97

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
@@ -461,8 +461,11 @@ def get_sqlalchemy_type(field: FieldInfo) -> Any:
461461
# UrlConstraints(max_length=512,
462462
# allowed_schemes=['smb', 'ftp', 'file']) ]
463463
if type_ is pydantic.AnyUrl:
464-
meta = field.metadata[0]
465-
return AutoString(length=meta.max_length)
464+
if field.metadata:
465+
meta = field.metadata[0]
466+
return AutoString(length=meta.max_length)
467+
else:
468+
return AutoString
466469

467470
org_type = get_origin(type_)
468471
if org_type is Annotated:

0 commit comments

Comments
 (0)