Skip to content

Commit

Permalink
Simplify type checking of sa_column
Browse files Browse the repository at this point in the history
isinstance directly supports using a tuple of allowed types.
  • Loading branch information
spazm committed Oct 29, 2024
1 parent 2853efe commit 1f0351b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sqlmodel/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ def get_column_from_field(field: Any) -> Union[Column, MappedColumn]: # type: i
else:
field_info = field.field_info
sa_column = getattr(field_info, "sa_column", Undefined)
if isinstance(sa_column, Column) or isinstance(sa_column, MappedColumn):
if isinstance(sa_column, (Column, MappedColumn)):
return sa_column
sa_type = get_sqlalchemy_type(field)
primary_key = getattr(field_info, "primary_key", Undefined)
Expand Down

0 comments on commit 1f0351b

Please sign in to comment.