You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 14, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on May 14, 2026. It is now read-only.
alembic incompatibility with sqlalchemy < 1.3.11 due to computed columns #269
at the beginning after the imports to force install the sqlalchemy versions with the incompatibilities. Then run the tests using nox -s migration_test. In alembic upgrade head, and the following error should occur:
<removed>
File "google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py", line 352, in get_column_specification
if column.computed is not None:
File "nox/migration_test/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 690, in __getattr__
key)
AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'computed'
This is because the sqlalchemy_spanner alembic code here refers to the computed attribute of Column, which was introduced in sqlalchemy 1.3.11 (release notes, code ref). So, for sqlalchemy versions < 1.3.11, this will throw the AttributeError above since Columns don't have the computed attribute.
A simple but maybe hacky fix would be to just check if the attribute exists before accessing it:
New version
if hasattr(column, "computed") and column.computed is not None:
colspec += " " + self.process(column.computed)
Old version
if column.computed is not None:
colspec += " " + self.process(column.computed)
but definitely open to suggestions for how to fix this!
Activity
elainearbaugh commentedon Oct 13, 2022
Created a PR with the fix I mentioned here: #270