On Apr 24, 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()
>

Aha found it.  Never mind.

session.connection().dialect

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