Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility with Alembic>1.11 #447

Merged
merged 1 commit into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions geoalchemy2/alembic_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def add_geo_column(context, revision, op):
if isinstance(col_type, (Geometry, Geography, Raster)):
op.column.type.spatial_index = False
op.column.type._spatial_index_reflected = None
new_op = AddGeospatialColumnOp(op.table_name, op.column, op.schema)
new_op = AddGeospatialColumnOp(op.table_name, op.column, schema=op.schema)
else:
new_op = op
return new_op
Expand All @@ -367,7 +367,7 @@ def drop_geo_column(context, revision, op):
dialect = context.bind.dialect
col_type = col_type.load_dialect_impl(dialect)
if isinstance(col_type, (Geometry, Geography, Raster)):
new_op = DropGeospatialColumnOp(op.table_name, op.column_name, op.schema)
new_op = DropGeospatialColumnOp(op.table_name, op.column_name, schema=op.schema)
else:
new_op = op
return new_op
Expand Down Expand Up @@ -471,7 +471,7 @@ def drop_geospatial_table(operations, operation):

if dialect.name == "sqlite":
_SPATIAL_TABLES.add(table_name)
operations.drop_table(table_name, operation.schema, **operation.table_kw)
operations.drop_table(table_name, schema=operation.schema, **operation.table_kw)


@renderers.dispatch_for(CreateGeospatialTableOp)
Expand All @@ -498,9 +498,9 @@ def create_geo_table(context, revision, op):
new_op = CreateGeospatialTableOp(
op.table_name,
op.columns,
op.schema,
op._namespace_metadata,
op._constraints_included,
schema=op.schema,
_namespace_metadata=op._namespace_metadata,
_constraints_included=op._constraints_included,
)
else:
new_op = op
Expand All @@ -518,7 +518,7 @@ def drop_geo_table(context, revision, op):
)

if gis_cols:
new_op = DropGeospatialTableOp(op.table_name, op.schema)
new_op = DropGeospatialTableOp(op.table_name, schema=op.schema)
else:
new_op = op

Expand Down Expand Up @@ -592,7 +592,7 @@ def drop_geospatial_index(
"""Handle the different situations arising from dropping geospatial index from a DB."""
op = cls(
index_name,
table_name,
table_name=table_name,
column_name=column_name,
schema=schema,
unique=unique,
Expand Down Expand Up @@ -714,7 +714,12 @@ def create_geo_index(context, revision, op):
op.kw["postgresql_ops"] = op.kw.get("postgresql_ops", postgresql_ops)

return CreateGeospatialIndexOp(
op.index_name, op.table_name, op.columns, op.schema, op.unique, **op.kw
op.index_name,
op.table_name,
op.columns,
schema=op.schema,
unique=op.unique,
**op.kw,
)

return op
Expand All @@ -733,7 +738,7 @@ def drop_geo_index(context, revision, op):
):
return DropGeospatialIndexOp(
op.index_name,
op.table_name,
table_name=op.table_name,
column_name=col.name,
schema=op.schema,
**op.kw,
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ setenv=
deps=
sqla14: SQLAlchemy==1.4.*
sqlalatest: SQLAlchemy
sqla14: Alembic==1.10.*
sqlalatest: Alembic
!pypy3: psycopg2
pypy3: psycopg2cffi
!pypy3: Shapely>=1.3.0
Expand Down