1

I installed GeoAlchemy using easy_install but when trying to import it returns the following:

Traceback (most recent call last): File "", line 1, in import geoalchemy File "C:\Python27\ArcGIS10.2\lib\site-packages\geoalchemy-0.7.2-py2.7.egg\geoalchemy__init__.py", line 2, in from geoalchemy.base import * File "C:\Python27\ArcGIS10.2\lib\site-packages\geoalchemy-0.7.2-py2.7.egg\geoalchemy\base.py", line 242, in class SpatialComparator(ColumnProperty.ColumnComparator): AttributeError: type object 'ColumnProperty' has no attribute 'ColumnComparator'

How to fix this?

3

From Geoalchemy docs:

Requires SQLAlchemy > 0.6. Supported on Python 2.5 and Python 2.6. Should also work with Python 2.4 but has not been tested.

No mention of Python 2.7, maybe this is your problem (I suppose you're using Python 2.7 because of the tag python27). Or it could be sqlalchemy version (too high, too low, don't know which you're using).

About fixing it, go for Geoalchemy 2 and PostgreSQL. If you want to use MySQL database, maybe try downgrading Python (Flask, Sqlalchemy...).

  • Yes, I'm using Python 2.7 and this is most likely the issue since my sqlalchemy is 0.9 – Matej Aug 26 '14 at 21:24
  • I've had the same problem. Unfortunately I couldn't downgrade or use postgres, so I had to let geoalchemy go. – Jakub Turcovsky Aug 27 '14 at 7:14
2

It seems SqlAlchemy have renamed ColumnComparator to Comparator, and used it interchangeably as shown here.

This pull request by github user chokoswitch seems to address that.

0

This might be worth for those that need GeoAlchemy (not GeoAlchemy2).

@Florian answer points out the reason for this error and a patch to fix it. Here is another solution, perhaps more easy to follow.

As stated here by user jackha, the following combination seems to work:

  • GeoAlchemy = 0.7.2
  • SQLAlchemy = 0.8.4

I had the same issue (on Python 2.7), which I solved by installing both packages in a virtualenv, like:

pip install sqlalchemy==0.8.4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.