Would it make sense for DB-SIG compliant modules to support a
cursor.fetchiter() type method, to use the iterator protocol
(instead of fetchall()'s current load-everything-into-memory
first approach). Clever extensions could be written to grab
N at a time, where N is less than 10,000,000, but more than 1 -
this then means you get faster performance than fetchone(),
and a less sucky API.
res = cursor.fetchone()
while res:
dostuffwith(res)
res = cursor.fetchone()
vs
for res in cursor.fetchiter():
dostuffwith(res)
And yes, you can get something that's most of the way there
now with something like the code in the cookbook entry
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/137270 -
just wondering if it's something worth adding to the API.
Anthony
--
Anthony Baxter <[EMAIL PROTECTED]>
It's never too late to have a happy childhood.
_______________________________________________
DB-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/db-sig