Skip to content
This repository was archived by the owner on Mar 13, 2026. It is now read-only.

Commit 273f03b

Browse files
minev-devolavloite
andauthored
fix: Add existing_nullable usage to visit_column_type (#329)
* fix: Add `existing_nullable` usage to `visit_column_type` Without this, altering operations (e.g. change column length) can cause nullability change of the column. It then causes error if this column is a part of index: "400 Changing NOT NULL constraints on column column_name is not allowed because it affects index index_name" * fix: add missing placeholder --------- Co-authored-by: Knut Olav Løite <koloite@gmail.com>
1 parent 013bd83 commit 273f03b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1564,8 +1564,9 @@ def visit_column_nullable(
15641564
def visit_column_type(
15651565
element: "ColumnType", compiler: "SpannerDDLCompiler", **kw
15661566
) -> str:
1567-
return "%s %s %s" % (
1567+
return "%s %s %s %s" % (
15681568
alter_table(compiler, element.table_name, element.schema),
15691569
alter_column(compiler, element.column_name),
15701570
"%s" % format_type(compiler, element.type_),
1571+
"" if element.existing_nullable else "NOT NULL",
15711572
)

0 commit comments

Comments
 (0)