[DB-SIG] perl-DBI like module for Python?

Anthony Tuininga 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?).
> 
> try:
>     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>
> http://www.stuartbishop.net/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (Darwin)
> 
> iD8DBQFAtIdrAfqZj7rGN0oRAupyAJ928Z2ZMeU/ukTYQYq07xOUna8CSgCdHYo0
> 6H4MLrRUZjhrTP0k50Y5E4A=
> =KKkP
> -----END PGP SIGNATURE-----
> 
> 
> _______________________________________________
> DB-SIG maillist  -  DB-SIG at python.org
> http://mail.python.org/mailman/listinfo/db-sig



More information about the DB-SIG mailing list