[GIS] GeoAlchethe: AttributeError: type object ‘ColumnProperty’ has no attribute ‘ColumnComparator’

geoalchemypython-2.7

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?

Best Answer

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...).

Related Question