[DB-SIG] Problem with exception classes

Wichert Akkerman wichert at wiggy.net
Thu Apr 17 19:18:03 EDT 2003

I've been using DB-API2 for a while now but have run into a few issues
with respect to portability between different SQL backends. One of those
is the paramstyle, which I'm happy to see might be addressed in DB-API3.

However issue I ran into is exception classes: a lot of my code is
passed a database connectino or a cursor and does not know which backend
it is attached to. However since DB-API2 species that exception types
can only be accesses directly from the driver module that means I can
not perform any exception handling. At the moment I work around this
by using a wrapper that copies the exception classes into the connection
instance (inspired by the MySQLdb module, which does that as well).

Is that something that would be useful to add to DB-API3 as well?


Wichert Akkerman <wichert at wiggy.net>           http://www.wiggy.net/
A random hacker

More information about the DB-SIG mailing list