def genrows(cursor: Cursor, arraysize: int = 1000) \
        -> Generator[List[Any], None, None]:
    """
    Generate all rows from a cursor.

    Args:
        cursor: the cursor
        arraysize: split fetches into chunks of this many records

    Yields:
        each row
    """
    # http://code.activestate.com/recipes/137270-use-generators-for-fetching-large-db-record-sets/  # noqa
    while True:
        results = cursor.fetchmany(arraysize)
        if not results:
            break
        for result in results:
            yield result
Generate all rows from a cursor.

    Args:
        cursor: the cursor
        arraysize: split fetches into chunks of this many records

    Yields:
        each row