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

Add to documentation an example on how to use reflection #110

Closed
vak opened this issue Sep 17, 2015 · 0 comments
Closed

Add to documentation an example on how to use reflection #110

vak opened this issue Sep 17, 2015 · 0 comments

Comments

@vak
Copy link

vak commented Sep 17, 2015

Hi,

i'm trying to use GeoAlchemy2 and saw in docs that DB reflection is supported. But there was no example on that :( The only thing found is tests/functional.py but it gave me no clue.

The following code snippet:

from sqlalchemy import create_engine, MetaData, Table
sql_uri = "postgresql+psycopg2://myuser:mypass@mydb.host.tld/mydbname" 
engine  = create_engine(sql_uri)
meta.reflect(bind=engine)

shows that geometry is not recognized:

/usr/lib/python2.7/site-packages/SQLAlchemy-1.0.8-py2.7-linux-x86_64.egg/sqlalchemy/dialects/postgresql/base.py:2454: SAWarning: Did not recognize type 'geometry' of column 'geometry'
/usr/lib/python2.7/site-packages/SQLAlchemy-1.0.8-py2.7-linux-x86_64.egg/sqlalchemy/dialects/postgresql/base.py:2454: SAWarning: Did not recognize type 'geometry' of column 'point'
...

which is fully clear, because one has to provide somehow the stuff from GeoAlchemy2.

You may want to add in docs that simple import like this is the only thing needed for the above SQLAlchemy reflection code snippet:

from geoalchemy2 import Geometry, Geography
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

2 participants