1 2 3 4 5 6 7
def fetchiter(cursor): rows = cursor.fetchmany() while rows: for row in rows: yield row rows = cursor.fetchmany()