sqlalchemy - type modifier is not allowed for type "geometry" when updating DB with postgis via geoalchemy2 & alembic -


my alembic update script adding new postgis geometry point looks this:

from alembic import op import sqlalchemy sa import geoalchemy2 ga  def upgrade():     op.add_column('stuff', sa.column('my_location', ga.geometry('point', management=true)))   def downgrade():     pass 

when run script via

alembic upgrade head 

the following error occurs

sqlalchemy.exc.programmingerror: (psycopg2.programmingerror) type modifier not allowed type "geometry" line 1: alter table events add column location geometry(point,-1) 

i using postgres 9.1, postgis 1.5, sqlalchemy 1.0.9, geoalchemy2 0.2.6.

you using postgis 1.5, not support type modifier geometry type.

how fix issue: postgis 1.5 quite old, upgrade postgis 2.x

if same reason cannot upgrade postgis installation, correct way add geometry column using function addgeometrycolumn(). sql statement looks so:

select addgeometrycolumn ('public','events','geom',0,'point',2); 

where arguments mean:

1) schema name, 2) table name, 3) column name, 4) srid, 5) type, 6) dimension.

however using correct flag adding geometry column in postgis 1.5: management=true. in accordance to documentation, should force sqlalchemy use addgeometrycolumn() syntax. maybe error coming alembic not geoalchemy?


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -