# This code require Python 2.2.1 or later from __future__ import generators # needs to be at the top of your module def ResultIter(cursor, arraysize=1000): 'An iterator that uses fetchmany to keep memory usage down' while True: results = cursor.fetchmany(arraysize) if not results: break for result in results: yield result To iterate through the result of a query, you often see code like this: # wh