Reputation: 35166
Some libraries and sites (like kotti) expose a database session that is loaded from a configuration file (it uses pyramid).
In general you can ignore the driver for sqlalchemy, but there are a few issues like getting a random row and using timezones with sqlite, which require you to have specific behavior for different engines.
Thing is, I can't see to find out how to determine what driver you're using at run time.
How do you do this?
Specifically, how, from a session (not an engine or a session factory) can you work backwards and figure this out?
Upvotes: 13
Views: 6327
Reputation: 7544
If you do this
session.bind.dialect.name
it will return something like sqlite
or mysql
, i.e. the part at the beginning of a URL (mysql://...
). Most other information can also be fetched from the dialect
object if you are interested in more. You can find this on any engine
or connection
(which bind
is).
Upvotes: 24