[DB-SIG] Proposed DB-API extensions

Anthony Baxter anthonybaxter at gmail.com
Thu Mar 20 02:04:02 CET 2008


2008/3/19 Gerhard Häring <gh at ghaering.de>:
> I'd like to propose the attached changes to the DB-API spec. My main
>  motivation is to make DB-API modules less cumbersome to use when used
>  directly.

>  ==> .execute(), .executemany() returning self.

+1

>  ==> .execute(), .executemany() in connection object.
>
>  They should have been placed here anyway. *cough* Users shouldn't have
>  to mess with cursor objects normally. Ability to write shorter code:

strong -1 from me. the lazy user can write
for row in conn.cursor().execute(...)
if they really don't care.

>  ==> __enter__ and __exit__ in the connection object.
>
>  Ability to automatically wrap database code in transactions, when using
>  Python 2.5 or higher:

Seems useful. +1.

>  ==> fetchscalar method in cursor object
>
>  This one is low-prio for me, but it's a common use case to only query a
>  scalar value.

I'm not convinced that fetchscalar() is the best name for this method.
It's meaning isn't immediately obvious. But I may just be dense :-)

Anthony


More information about the DB-SIG mailing list