[DB-SIG] perl-DBI like module for Python?
stuart.b at commonground.com.au
Wed May 26 10:03:31 EDT 2004
-----BEGIN PGP SIGNED MESSAGE-----
On 26/05/2004, at 2:51 PM, Anthony Tuininga wrote:
> 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!
Its one of the optional extensions. Search for 'Connection Attributes
.Error' in http://www.python.org/peps/pep-0249.html
I think it is high time to release DB-API 2.1 with most of the
optional extensions moved to core.
Stuart Bishop <stuart at stuartbishop.net>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)
-----END PGP SIGNATURE-----
More information about the DB-SIG