Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geoalchemy raises AssertationError #16

Open
denvaar opened this issue Dec 14, 2015 · 4 comments
Open

Geoalchemy raises AssertationError #16

denvaar opened this issue Dec 14, 2015 · 4 comments

Comments

@denvaar
Copy link
Contributor

denvaar commented Dec 14, 2015

Geoalchemy raises an AssertationError when using the API's getDetailedResultInfo method. As a work-around, I can comment out line 88 in base.py, but then it will not actually create a geometry.

    File "/home/denver/Documents/ODM2PythonAPI/src/api/ODM2/services/readService.py", line 195, in getDetailedResultInfo
    for r,s,m,v,p,u in q.all():
  File "/home/denver/miniconda/envs/SDL-env/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2398, in all
    return list(self)
  File "/home/denver/miniconda/envs/SDL-env/lib/python2.7/site-packages/sqlalchemy/orm/loading.py", line 84, in instances
    util.raise_from_cause(err)
  File "/home/denver/miniconda/envs/SDL-env/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/home/denver/miniconda/envs/SDL-env/lib/python2.7/site-packages/sqlalchemy/orm/loading.py", line 72, in instances
    for row in fetch]
  File "/home/denver/miniconda/envs/SDL-env/lib/python2.7/site-packages/sqlalchemy/orm/loading.py", line 426, in _instance
    loaded_instance, populate_existing, populators)
  File "/home/denver/miniconda/envs/SDL-env/lib/python2.7/site-packages/sqlalchemy/orm/loading.py", line 484, in _populate_full
    dict_[key] = getter(row)
  File "/home/denver/miniconda/envs/SDL-env/lib/python2.7/site-packages/geoalchemy/geometry.py", line 27, in process
    return DialectManager.get_spatial_dialect(dialect).process_result(value, self)
  File "/home/denver/miniconda/envs/SDL-env/lib/python2.7/site-packages/geoalchemy/mssql.py", line 311, in process_result
    return MSPersistentSpatialElement(WKBSpatialElement(value, type.srid))
  File "/home/denver/miniconda/envs/SDL-env/lib/python2.7/site-packages/geoalchemy/base.py", line 88, in __init__
    assert isinstance(desc, (basestring, buffer))
AssertionError
@valentinedwv
Copy link
Member

Turn on logging support to SQL in the module.

import logging
logging.basicConfig()

logging.getLogger('sqlalchemy.engine').setLevel(logging.DEBUG)

Suggestion, can we write a set of tests against the DB's we want to support,
support detailed logging passing echo-true to the create

engine = sqlalchemy.create_engine('postgres://foo/bar', echo=True)

On Mon, Dec 14, 2015 at 1:49 PM, Denver Smith [email protected]
wrote:

Geoalchemy raises an AssertationError when using the API's
getDetailedResultInfo method As a work-around, I can comment out line 88 in
basepy, but then it will not actually create a geometry

File "/home/denver/Documents/ODM2PythonAPI/src/api/ODM2/services/readServicepy", line 195, in getDetailedResultInfo
for r,s,m,v,p,u in qall():

File "/home/denver/miniconda/envs/SDL-env/lib/python27/site-packages/sqlalchemy/orm/querypy", line 2398, in all
return list(self)
File "/home/denver/miniconda/envs/SDL-env/lib/python27/site-packages/sqlalchemy/orm/loadingpy", line 84, in instances
utilraise_from_cause(err)
File "/home/denver/miniconda/envs/SDL-env/lib/python27/site-packages/sqlalchemy/util/compatpy", line 199, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb)
File "/home/denver/miniconda/envs/SDL-env/lib/python27/site-packages/sqlalchemy/orm/loadingpy", line 72, in instances
for row in fetch]
File "/home/denver/miniconda/envs/SDL-env/lib/python27/site-packages/sqlalchemy/orm/loadingpy", line 426, in _instance
loaded_instance, populate_existing, populators)
File "/home/denver/miniconda/envs/SDL-env/lib/python27/site-packages/sqlalchemy/orm/loadingpy", line 484, in populate_full
dict
[key] = getter(row)
File "/home/denver/miniconda/envs/SDL-env/lib/python27/site-packages/geoalchemy/geometrypy", line 27, in process
return DialectManagerget_spatial_dialect(dialect)process_result(value, self)
File "/home/denver/miniconda/envs/SDL-env/lib/python27/site-packages/geoalchemy/mssqlpy", line 311, in process_result
return MSPersistentSpatialElement(WKBSpatialElement(value, typesrid))
File "/home/denver/miniconda/envs/SDL-env/lib/python27/site-packages/geoalchemy/basepy", line 88, in init
assert isinstance(desc, (basestring, buffer))
AssertionError


Reply to this email directly or view it on GitHub
#16.

@valentinedwv
Copy link
Member

I redid the setup.py, can you make a new virtual environment, and test to see if pulling from the ODM2 forked geoalchemy solves the issue?

@emiliom
Copy link
Member

emiliom commented Dec 16, 2015

@denvaar, are you using the right version of geoalchemy1? See issue #13, including @valentinedwv's comment about the changes he made so that odm2api picks up the right geoalchemy (the odm2 branch of https://github.com/ODM2/geoalchemy)

@emiliom
Copy link
Member

emiliom commented Jan 13, 2016

@denvaar, are you still getting this error, or can we close this issue?

FYI (and for @horsburgh and anyone else), I've created instructions for installing odm2api using conda packages for all the dependencies except geoalchemy, followed by a single pip install command to install odm2api and geoalchemy. See README.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants