def fetchiter(cursor, arraysize=10000):
    """Generator for cursor results"""
    while True:
        rows = cursor.fetchmany(arraysize)
        print(rows)
        if rows == []:
            break
        for row in rows:
            yield row
