-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Labels
api: spannerIssues related to the googleapis/python-spanner-sqlalchemy API.Issues related to the googleapis/python-spanner-sqlalchemy API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Environment details
OS: Windows 10
Programming language: Python
Language runtime version: 3.9.12
sqlalchemy-spanner version: 1.2.1
google-cloud-spanner version: 3.17.0
alembic version : 1.8.1
Steps to reproduce
Add a 'unique' constraint to a model thus:
class Tag(Base):
__tablename__ = 'tag'
tag = Column(String, primary_key=True)
test = Column(String, unique=True)
Output
Whether this line is added to an existing model or when creating a new one, the line generated for the migration is either op.create_unique_constraint(None, ['test']) in an op.batch_alter_table(), or sa.UniqueConstraint('version') in an op.create_table().
Running either of those during a migrations gives the following error:
google.cloud.spanner_dbapi.exceptions.ProgrammingError: Spanner doesn't support direct UNIQUE constraints creation. Create UNIQUE indexes instead.
Metadata
Metadata
Assignees
Labels
api: spannerIssues related to the googleapis/python-spanner-sqlalchemy API.Issues related to the googleapis/python-spanner-sqlalchemy API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.