Alembic helpers¶
Some helpers to use with Alembic migration tool.
-
class
geoalchemy2.alembic_helpers.
AddGeospatialColumn
(table_name: str, column: Column, schema: Optional[str] = None, **kw)[source]¶ Bases:
alembic.operations.ops.AddColumnOp
Add a Geospatial Column in an Alembic migration context. This methodology originates from: https://alembic.sqlalchemy.org/en/latest/api/operations.html#operation-plugins
-
class
geoalchemy2.alembic_helpers.
DropGeospatialColumn
(table_name: str, column_name: str, schema: Optional[str] = None, _reverse: Optional[AddColumnOp] = None, **kw)[source]¶ Bases:
alembic.operations.ops.DropColumnOp
Drop a Geospatial Column in an Alembic migration context.
-
geoalchemy2.alembic_helpers.
add_geospatial_column
(operations, operation)[source]¶ Handle the actual column addition according to the dialect backend.
Parameters: - operations – Operations object from alembic base, defining high level migration operations.
- operation – AddGeospatialColumn call, with attributes for table_name, column_name, column_type, and optional keywords.
-
geoalchemy2.alembic_helpers.
drop_geospatial_column
(operations, operation)[source]¶ Handle the actual column removal according to the dialect backend.
Parameters: - operations – Operations object from alembic base, defining high level migration operations.
- operation – AddGeospatialColumn call, with attributes for table_name, column_name, column_type, and optional keywords.
-
geoalchemy2.alembic_helpers.
include_object
(obj, name, obj_type, reflected, compare_to)[source]¶ Do not include spatial indexes if they are automatically created by GeoAlchemy2.
-
geoalchemy2.alembic_helpers.
render_add_geo_column
(autogen_context, op)[source]¶ Render the add_geospatial_column operation in migration script.