-
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
The ALTER COLUMN DDL does not include existing DEFAULT values, which causes DEFAULT values to be dropped when running it.
For ALTER COLUMN DDL, Spanner always requires the full table definition. DDL like:
ALTER TABLE tbl ALTER COLUMN col STRING(MAX)would remove any previously defined DEFAULT. The full definition needs to be present:
ALTER TABLE tbl ALTER COLUMN col STRING(MAX) DEFAULT the_defaultto avoid dropping previously defined defaults. The DDL emitted by visit_column_type and visit_column_nullable should respect element.existing_server_default if it's passed in.
Environment details
- Programming language: Python
- OS: linux
- Language runtime version: 3.8
- Package version: 1.14.0
Steps to reproduce
create an alembic alter column migration like:
op.alter_column(
"tbl",
"id",
existing_type=sa.String(length=2621440),
type_=sa.String(length=50),
existing_nullable=False,
existing_server_default=sa.text("GENERATE_UUID()"),
schema="design_raw",
)
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.