def yield_per(query, n=100):
    """
like the `yield_per` method, but doesn't keep the cursor busy.
the SQL query must have a well-defined order"""
    i = 0
    while True:
        xs = tuple(query.slice(i, i + n).all())
        yield from xs
        if len(xs) < n:
            break
        i += n
