Skip to content

Commit

Permalink
support AnyURL
Browse files Browse the repository at this point in the history
  • Loading branch information
honglei committed Aug 25, 2023
1 parent cb6ccf4 commit 4213c97
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sqlmodel/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,11 @@ def get_sqlalchemy_type(field: FieldInfo) -> Any:
# UrlConstraints(max_length=512,
# allowed_schemes=['smb', 'ftp', 'file']) ]
if type_ is pydantic.AnyUrl:
meta = field.metadata[0]
return AutoString(length=meta.max_length)
if field.metadata:
meta = field.metadata[0]
return AutoString(length=meta.max_length)
else:
return AutoString

org_type = get_origin(type_)
if org_type is Annotated:
Expand Down

0 comments on commit 4213c97

Please sign in to comment.