Python3 + sqlite3: Where's the bug?
rosuav at gmail.com
Thu Dec 20 16:05:31 CET 2012
On Fri, Dec 21, 2012 at 1:52 AM, Johannes Bauer <dfnsonfsduifb at gmx.de> wrote:
> def fetchmanychks(cursor):
> cursor.execute("SELECT id FROM foo;")
> while True:
> result = cursor.fetchmany()
> if len(result) == 0:
> for x in result:
> yield x
I'm not familiar with sqlite, but from working with other databases,
I'm wondering if possibly your commits are breaking the fetchmany.
Would it spoil your performance improvements to do all the fetchmany
calls before yielding anything? Alternatively, can you separate the
two by opening a separate database connection for the foo-reading (so
it isn't affected by the commit)?
More information about the Python-list