On Apr 24, 2010, at 10:00 AM, Roy Hyunjin Han <starsareblueandfara...@gmail.com > wrote:

Is there any way to retrieve the database dialect that a specific
session is using?  e.g. MySQL, PostGIS, etc.

I am trying to modify Sanjiv Singh's GeoAlchemy extension so that a
person can retrieve the appropriate database procedure for a given
dialect, so that geospatial queries can be both direct (performed in a
single database call) as well as dialect-neutral.

For example, in PostGIS, getting the WKT of a geometry requires func.ST_AsText()
session.query(func.ST_AsText(Road.geom)).first()

However, in MySQL, the same procedure requires func.AsText()
session.query(func.AsText(Road.geom)).first()

I would like to be able to create a function called wkt() in both
geoalchemy/mysql.py and geoalchemy/postgis.py that enables me to the
following:
session.query(session.dialect.wkt(Road.geom)).first()

As I explained to sanjiv at pycon earlier this year, the best route to dialect specific resolution of SQL constructs is via the construction of custom SQL elements in combination with the sqlalchemy.ext.compiler extension - it's in the docs.



Thanks,
Roy Hyunjin Han
Modi Research Group
Earth Institute at Columbia University
http://modi.mech.columbia.edu

--
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en .


--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to