get_column_from_field support function

This commit is contained in:
honglei 2023-08-15 18:13:24 +08:00
parent 46b130dfb7
commit f3e7811a80

View File

@ -524,6 +524,8 @@ def get_column_from_field(field: FieldInfo) -> Column: # type: ignore
return sa_column
if isinstance(sa_column, MappedColumn):
return sa_column.column
if isinstance(sa_column, types.FunctionType):
return sa_column()
sa_type = get_sqlalchemy_type(field)
primary_key = getattr(field, "primary_key", False)
index = getattr(field, "index", PydanticUndefined)