Skip to content

Commit

Permalink
fix python type.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmyjoe committed Jul 5, 2023
1 parent 4ac6a3e commit 0fbf33d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sqlacodegen/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1217,8 +1217,8 @@ def render_column_attribute(self, column_attr: ColumnAttribute) -> str:
try:
# FIXME: this is due to sqlalchemy associate JSON to dict, but actually there is a case that JSON is list
# https://github.com/sqlalchemy/sqlalchemy/blob/main/lib/sqlalchemy/sql/sqltypes.py#L2665
python_type = column.type.python_type if not isinstance(column.type, JSONB) else Union[dict, list]
python_type_name = python_type.__name__
python_type = column.type.python_type
python_type_name = python_type.__name__ if not isinstance(column.type, JSONB) else "Union[dict, list]"
if python_type.__module__ == "builtins":
column_python_type = python_type_name
else:
Expand Down

0 comments on commit 0fbf33d

Please sign in to comment.