def column_windows(session, column, windowsize):

    def int_for_range(start_id, end_id):
        if end_id:
            return and_(column >= start_id, column < end_id)
        else:
            return column >= start_id

    q = session.query(
        column,
        func.row_number().over(order_by=column).label('rownum')
    ).from_self(column)

    if windowsize > 1:
        q = q.filter(text("rownum %% %d=1" % windowsize))

    intervals = [row[0] for row in q]

    while intervals:
        start = intervals.pop(0)
        if intervals:
            end = intervals[0]
        else:
            end = None

        yield int_for_range(start, end)
For implementation of Timer() we use xpcom interfaces
dataset/ETHPy150Open pypa/warehouse/warehouse/utils/db/windowed_query.py/column_windows--crossover with--dataset/ETHPy150Open pyjs/pyjs/pyjs/runners/hula.py/Browser.nsITimer