[DB-SIG] perl-DBI like module for Python?
anthony at computronix.com
Wed May 26 09:51:13 EDT 2004
Stuart Bishop wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> On 24/05/2004, at 4:57 PM, Mihai Ibanescu wrote:
>> Example: I have my application running against Postgres. I have to be
>> able to
>> port it to Oracle too. Unfortunately, code that tries to catch
>> DatabaseException will have to look for the cx_Oracle
>> DatabaseException, not
>> for the postgres one.
> The exceptions are most likely exposed through your connection object
> (I think most the major drivers support this option now?).
> cur = con.cursor()
> cur.excecute('select foo from bar')
> except con.DatabaseException:
> print 'Oops!'
Huh? My reading of the DB API says that the exceptions are defined at
the __MODULE__ level, not the __CONNECTION__ level. Or am I missing
something??? Please inform me!
> - -- Stuart Bishop <stuart at stuartbishop.net>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (Darwin)
> -----END PGP SIGNATURE-----
> DB-SIG maillist - DB-SIG at python.org
More information about the DB-SIG