Skip to content

Commit

Permalink
Bumped up the minimum SQLAlchemy version
Browse files Browse the repository at this point in the history
This should partially address #193.
  • Loading branch information
agronholm committed Apr 26, 2022
1 parent 74174e4 commit 5029eb1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Version history
- Added support for generating SQLModel classes (PR by Andrii Khirilov)
- Fixed code generation when a single-column index is unique or does not match the
dialect's naming convention (PR by Leonardus Chen)
- Increased mimimum SQLAlchemy version to 1.4.36 to address issues with ``ForeignKey``
and indexes, and to eliminate the PostgreSQL UUID column type annotation hack

**3.0.0rc1**

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ classifiers = [
]
requires-python = ">=3.7"
dependencies = [
"SQLAlchemy >= 1.4.0",
"SQLAlchemy >= 1.4.36",
"inflect >= 4.0.0",
"importlib_metadata; python_version < '3.10'",
]
Expand Down
15 changes: 3 additions & 12 deletions src/sqlacodegen/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1263,9 +1263,7 @@ def collect_imports_for_column(self, column: Column[Any]) -> None:
try:
python_type = column.type.python_type
except NotImplementedError:
if column.type.__class__.__name__ != "UUID":
# Workaround for https://github.com/sqlalchemy/sqlalchemy/issues/7943
self.add_literal_import("typing", "Any")
pass
else:
self.add_import(python_type)

Expand Down Expand Up @@ -1300,11 +1298,7 @@ def render_column_attribute(self, column_attr: ColumnAttribute) -> str:
try:
python_type = column.type.python_type
except NotImplementedError:
if column.type.__class__.__name__ == "UUID":
# Workaround for https://github.com/sqlalchemy/sqlalchemy/issues/7943
python_type_name = "str"
else:
python_type_name = "Any"
python_type_name = "Any"
else:
python_type_name = python_type.__name__

Expand Down Expand Up @@ -1428,10 +1422,7 @@ def render_column_attribute(self, column_attr: ColumnAttribute) -> str:
try:
python_type = column.type.python_type
except NotImplementedError:
if column.type.__class__.__name__ == "UUID":
python_type_name = "str"
else:
python_type_name = "Any"
python_type_name = "Any"
else:
python_type_name = python_type.__name__

Expand Down

0 comments on commit 5029eb1

Please sign in to comment.