Skip to content

Commit

Permalink
fix: alembic incompatibility with sqlalchemy < 1.3.11 (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaFaer authored Dec 1, 2022
1 parent 7f65972 commit f99f3a7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def get_column_specification(self, column, **kwargs):
if default is not None:
colspec += " DEFAULT (" + default + ")"

if column.computed is not None:
if hasattr(column, "computed") and column.computed is not None:
colspec += " " + self.process(column.computed)

return colspec
Expand Down
14 changes: 14 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,20 @@ def unit(session):

@nox.session(python=DEFAULT_PYTHON_VERSION)
def migration_test(session):
"""Test migrations with SQLAlchemy v1.3.11+ and Alembic"""
session.run("pip", "install", "sqlalchemy>=1.3.11", "--force-reinstall")
_migration_test(session)


@nox.session(python=DEFAULT_PYTHON_VERSION)
def migration_test_1310(session):
"""Test migrations with SQLAlchemy 1.3.10 or lower and Alembic"""
session.run("pip", "install", "sqlalchemy>=1.1.13,<=1.3.10", "--force-reinstall")
_migration_test(session)


@nox.session(python=DEFAULT_PYTHON_VERSION)
def _migration_test(session):
"""Migrate with SQLAlchemy and Alembic and check the result."""
import glob
import os
Expand Down

0 comments on commit f99f3a7

Please sign in to comment.