Skip to content

SQLAlchemy requires extend_existing #117

@florianm

Description

@florianm

Datacats CKAN "latest" (2.5a) with our ckanext-spatial fork which is exactly up to date with upstream/master.

With SQLAlchemy==0.9.6 installed, booting up CKAN trips when spatial inits their tables.
SQLAlchemy defaults to creating/updating tables with Table(..., column defs, extend_existing=False), we'll need True:

  File "/project/ckanext-spatial/ckanext/spatial/plugin.py", line 78, in configure
    setup_model()
  File "/project/ckanext-spatial/ckanext/spatial/model/package_extent.py", line 22, in setup
    define_spatial_tables(srid)
  File "/project/ckanext-spatial/ckanext/spatial/model/package_extent.py", line 69, in define_spatial_tables
    package_extent_table = setup_spatial_table(PackageExtent, db_srid)
  File "/project/ckanext-spatial/ckanext/spatial/geoalchemy_common.py", line 74, in setup_spatial_table
    management=management)),
  File "/usr/lib/ckan/local/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 339, in __new__
    "existing Table object." % key)
sqlalchemy.exc.InvalidRequestError: Table 'package_extent' is already defined for this MetaData instance.  Specify 'extend_existing=True' to redefine options and columns on an existing Table object.
Starting subprocess with file monitor

This sounds similar to ckan/ckanext-pages#27. I'll attempt a fix now, if you don't hear a PR from me, send coffee and help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions