Using SQLAlchemy with Spatial Databases.
GeoAlchemy 2 provides extensions to SQLAlchemy for working with spatial databases.
GeoAlchemy 2 focuses on PostGIS. PostGIS 1.5 and PostGIS 2 are supported.
Note
GeoAlchemy 2 doesn’t currently support other dialects than PostgreSQL/PostGIS. Supporting Oracle Locator in the previous series was the main contributor to code complexity. So it is currently not clear whether we want to go there again.
GeoAlchemy 2 aims to be simpler than its predecessor, GeoAlchemy. Simpler to use, and simpler to maintain.
GeoAlchemy 2 requires SQLAlchemy 0.8. GeoAlchemy 2 does not work with SQLAlchemy 0.7 and lower.
GeoAlchemy 2 is available on the Python Package Index. So it can be installed with the standard pip or easy_install tools.
See the Migrate to GeoAlchemy 2 page for details on how to migrate a GeoAlchemy application to GeoAlchemy 2.
GeoAlchemy 2 works with both SQLAlchemy’s Object Relational Mapping (ORM) and SQL Expression Language. This documentation provides a tutorial for each system. If you’re new to GeoAlchemy 2 start with this.
The code is available on GitHub: https://github.com/geoalchemy/geoalchemy2.
Contributors:
Many thanks to Mike Bayer for his guidance and support! He also fostered the birth of GeoAlchemy 2.