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

Denis S. Otkidach ods at strana.ru
Wed May 26 11:26:19 EDT 2004

On Wed, 26 May 2004, Anthony Tuininga wrote:

AT> > try:
AT> >     cur = con.cursor()
AT> >     cur.excecute('select foo from bar')
AT> > except con.DatabaseException:
AT> >     print 'Oops!'
AT> Huh? My reading of the DB API says that the exceptions are
AT> defined at
AT> the __MODULE__ level, not the __CONNECTION__ level. Or am I
AT> missing
AT> something??? Please inform me!

I see no problem here.

con = db_module.connect(...)
cur = con.cursor()
    cur.excecute('select foo from bar')
except db_module.DatabaseException:
     print 'Oops!'

But exposing exceptions as connection attributes would be more

Denis S. Otkidach
http://www.python.ru/      [ru]

More information about the DB-SIG mailing list