[DB-SIG] Iterable cursor as part of core rather than an extension in DBAPI 3

Tony Locke tlocke at tlocke.org.uk
Thu Oct 24 11:57:31 CEST 2013

Hi, in DBAPI 3 is there a plan to bring the 'iterable cursor' extension
into the core? Looking at https://wiki.python.org/moin/DbApi3 I couldn't
see anything. The reason I ask is that I'm noticing on PG8000 that the time
taken to execute the warn() for each call to next() is significant for
iterating over a large number of rows.

I'm on the verge of suggesting getting rid of fetchmany() and just having
the iterable, and making execute() return the cursor. Then instead of:

cursor.execute("select * from emp")
all_emps = cursor.fetchmany()

you'd have:

all_emps = [cursor.execute("select * from emp")]

or you could do:

for emp in cursor.execute("select * from emp"):


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/db-sig/attachments/20131024/68e3843c/attachment.html>

More information about the DB-SIG mailing list