Skip to content

Commit

Permalink
Don't rely on sqlalchemy.__all__ being present
Browse files Browse the repository at this point in the history
The __all__ attribute was removed in v2.0.
  • Loading branch information
agronholm committed Feb 26, 2023
1 parent 4669532 commit 6039205
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sqlacodegen/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def add_import(self, obj: Any) -> None:

if type_.__name__ in dialect_pkg.__all__:
pkgname = dialect_pkgname
elif type_.__name__ in sqlalchemy.__all__: # type: ignore[attr-defined]
elif type_.__name__ in dir(sqlalchemy):
pkgname = "sqlalchemy"
else:
pkgname = type_.__module__
Expand Down

0 comments on commit 6039205

Please sign in to comment.