def cursor_iter(cursor, sentinel, col_count):
    '\n    Yields blocks of rows from a cursor and ensures the cursor is closed when\n    done.\n    '
    try:
        for rows in iter((lambda : cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)), sentinel):
            (yield [r[0:col_count] for r in rows])
    finally:
        cursor.close()
Yields blocks of rows from a cursor and ensures the cursor is closed when
done.
def cursor_iter(cursor, sentinel, col_count):
    '\n    Yields blocks of rows from a cursor and ensures the cursor is closed when\n    done.\n    '
    try:
        for rows in iter((lambda : cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)), sentinel):
            (yield [r[0:col_count] for r in rows])
    finally:
        cursor.close()