Hello again, It seems that db.commit() is necessary to get the query to reflect the changed state of the database for some reason.
The simple code at the end of this message illustrates the problem. Starting two ipython sessions, and running side1() in one, and then side2() in the other, if the db.commit() line in the side1 loop is removed, it will loop forever even though the database is actually updated by side2. This work around works, but I'd like to understand what's going on. Thanks, G ======== dbtest.py ======= from gluon import * import time db = DAL('mysql://web2py:web2py@localhost:33306/web2py', folder = '/home/dl/trunkw2p/web2py/applications/ devel/databases') db.define_table( 'test', Field('status',requires=IS_NOT_EMPTY())) def side1(): id = db.test.insert(status='queued') db.commit() query = (db.test.id == id) & ((db.test.status == 'start') | (db.test.status == 'queued')) while db(query).count(): print "query", [str(x) for x in db(query).select()] db.commit() # !!! Comment out this line and this while loop will never exit time.sleep(0.1) print "done" def side2(): id = db(db.test.id>0).select().last().id print "found id",id time.sleep(5) db(db.test.id == id).update(status='start') db.commit() print "finishing" time.sleep(5) db(db.test.id == id).update(status='done') db.commit() print "finished"