ckan / ckanext-spatial

Geospatial extension for CKAN
http://docs.ckan.org/projects/ckanext-spatial
126 stars 193 forks source link

"ColumnCollection" exception with SQLAlchemy 0.9 #156

Closed davidread closed 8 years ago

davidread commented 8 years ago

When doing 'paster db init' I get an exception:

(ckan)co@precise64:/src/ckan$ paster db init -c /var/ckan/ckan-test.ini
2016-06-23 13:13:13,091 DEBUG [ckanext.spatial.model.package_extent] Spatial tables defined in memory
Traceback (most recent call last):
  File "/home/co/ckan/bin/paster", line 9, in <module>
    load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
  File "/home/co/ckan/local/lib/python2.7/site-packages/paste/script/command.py", line 104, in run
    invoke(command, command_name, options, args[1:])
  File "/home/co/ckan/local/lib/python2.7/site-packages/paste/script/command.py", line 143, in invoke
    exit_code = runner.run(args)
  File "/home/co/ckan/local/lib/python2.7/site-packages/paste/script/command.py", line 238, in run
    result = self.command()
  File "/src/ckanext-archiver/ckanext/archiver/commands.py", line 110, in command
    self._load_config()
  File "/src/ckan/ckan/lib/cli.py", line 138, in _load_config
    load_environment(conf.global_conf, conf.local_conf)
  File "/src/ckan/ckan/config/environment.py", line 232, in load_environment
    p.load_all(config)
  File "/src/ckan/ckan/plugins/core.py", line 134, in load_all
    load(*plugins)
  File "/src/ckan/ckan/plugins/core.py", line 167, in load
    plugins_update()
  File "/src/ckan/ckan/plugins/core.py", line 116, in plugins_update
    environment.update_config()
  File "/src/ckan/ckan/config/environment.py", line 357, in update_config
    plugin.configure(config)
  File "/src/ckanext-spatial/ckanext/spatial/plugin.py", line 74, in configure
    setup_model()
  File "/src/ckanext-spatial/ckanext/spatial/model/package_extent.py", line 35, in setup
    package_extent_table.create()
  File "/home/co/ckan/local/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 648, in create
    checkfirst=checkfirst)
  File "/home/co/ckan/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1555, in _run_visitor
    conn._run_visitor(visitorcallable, element, **kwargs)
  File "/home/co/ckan/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1202, in _run_visitor
    **kwargs).traverse_single(element)
  File "/home/co/ckan/local/lib/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 119, in traverse_single
    return meth(obj, **kw)
  File "/home/co/ckan/local/lib/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 722, in visit_table
    _ddl_runner=self)
  File "/home/co/ckan/local/lib/python2.7/site-packages/sqlalchemy/event/attr.py", line 257, in __call__
    fn(*args, **kw)
  File "/src/geoalchemy/geoalchemy/geometry.py", line 125, in before_create
    self('before-create', target, connection)
  File "/src/geoalchemy/geoalchemy/geometry.py", line 108, in __call__
    expression.ColumnCollection(*regular_cols))
TypeError: __init__() takes exactly 1 argument (2 given)

This is with ckan 2.2, Geoalchemy (chokoswitch fork) & sqlalchemy 0.9.6.

davidread commented 8 years ago

I solved this by upgrading SQLAlchemy to 0.9.8.

It seems that SQLAlchemy removed the arguments from its constructor for ColumnCollection on versions 0.9.4-0.9.7 (inclusive). There was a patch to geoalchemy that never got merged, no doubt because effort switched to geoalchemy2.

I'm recording this, in case anyone else has this issue in future. We should probably all upgrade our ckans and move to geoalchemy2.