Skip to content

Commit 5029eb1

Browse files
committed
Bumped up the minimum SQLAlchemy version
This should partially address #193.
1 parent 74174e4 commit 5029eb1

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

CHANGES.rst

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Version history
66
- Added support for generating SQLModel classes (PR by Andrii Khirilov)
77
- Fixed code generation when a single-column index is unique or does not match the
88
dialect's naming convention (PR by Leonardus Chen)
9+
- Increased mimimum SQLAlchemy version to 1.4.36 to address issues with ``ForeignKey``
10+
and indexes, and to eliminate the PostgreSQL UUID column type annotation hack
911

1012
**3.0.0rc1**
1113

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ classifiers = [
2828
]
2929
requires-python = ">=3.7"
3030
dependencies = [
31-
"SQLAlchemy >= 1.4.0",
31+
"SQLAlchemy >= 1.4.36",
3232
"inflect >= 4.0.0",
3333
"importlib_metadata; python_version < '3.10'",
3434
]

src/sqlacodegen/generators.py

+3-12
Original file line numberDiff line numberDiff line change
@@ -1263,9 +1263,7 @@ def collect_imports_for_column(self, column: Column[Any]) -> None:
12631263
try:
12641264
python_type = column.type.python_type
12651265
except NotImplementedError:
1266-
if column.type.__class__.__name__ != "UUID":
1267-
# Workaround for https://github.com/sqlalchemy/sqlalchemy/issues/7943
1268-
self.add_literal_import("typing", "Any")
1266+
pass
12691267
else:
12701268
self.add_import(python_type)
12711269

@@ -1300,11 +1298,7 @@ def render_column_attribute(self, column_attr: ColumnAttribute) -> str:
13001298
try:
13011299
python_type = column.type.python_type
13021300
except NotImplementedError:
1303-
if column.type.__class__.__name__ == "UUID":
1304-
# Workaround for https://github.com/sqlalchemy/sqlalchemy/issues/7943
1305-
python_type_name = "str"
1306-
else:
1307-
python_type_name = "Any"
1301+
python_type_name = "Any"
13081302
else:
13091303
python_type_name = python_type.__name__
13101304

@@ -1428,10 +1422,7 @@ def render_column_attribute(self, column_attr: ColumnAttribute) -> str:
14281422
try:
14291423
python_type = column.type.python_type
14301424
except NotImplementedError:
1431-
if column.type.__class__.__name__ == "UUID":
1432-
python_type_name = "str"
1433-
else:
1434-
python_type_name = "Any"
1425+
python_type_name = "Any"
14351426
else:
14361427
python_type_name = python_type.__name__
14371428

0 commit comments

Comments
 (0)