Sqlalchemy:类型geoalchemy2不存在

2024-09-26 17:49:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图在postgresql数据库上运行迁移,我使用python烧瓶。跟随出现错误:

type "geometry" does not exists

迁移是:

    """empty message

Revision ID: a9d0c3e2ac85
Revises: 06493ef33fab
Create Date: 2016-08-28 01:00:41.022063

"""

# revision identifiers, used by Alembic.
revision = 'a9d0c3e2ac85'
down_revision = '06493ef33fab'

from alembic import op
import sqlalchemy as sa
import geoalchemy2


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('location', sa.Column('coordinates', geoalchemy2.types.Geometry(geometry_type='POINT'), nullable=True))
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('location', 'coordinates')
    ### end Alembic commands ###

我的计划是:

^{pr2}$

Tags: importautobydeftypesaalembicrevision

热门问题