On 12 April 2012 08:51, weheh <richard_gor...@verizon.net> wrote: > I need to limit my processing of db entries to chunks of, let's say, 100. > So I want to first get the data: > > data = db(db.mytable.flag == False).select(limitby=(0,100)) > > for d in data: > # do something > > Then I want to set mytable.flag to True after the above loop is done, but > only for the same 100 entries I've just retrieved. > > BUT, while this is going on, someone else may be adding new entries with > mytable.flag=False to the table. > > So without iterating one-by-one on "data", is there a one-liner to update > mytable.flag to True for the 100 entries I already retrieved? >
What about something like ids = [x.id for x in data] db(db.mytable.id.belongs(ids)).update(db.mytable.flag = True) ? Or just store ids and in the next 'select' exclude those ids from your query. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)