db(db.user.id==1).update( **dict(first_name='Jack', title='CEO' ) ) or
db.user[1] = dict(first_name='Jack', title='CEO') On May 4, 10:56 am, PanosJee <panos...@gmail.com> wrote: > Hello everyone I hope you are doing fine. > > I want to update a record but I do not know in advance the fields i > want to update. I would like to create a dict with the fields and do > the following. > > db(db.user.id==1).update( dict(first_name='Jack', title='CEO' ) ) > db(db.user.id==2).update( dict(last_name='Vlachoyannis', title='CTO', > salary=1800000 ) ) > db(db.user.id==5).update( dict(id=8) ) > > I tried some different input but no success. Any suggestions ? > > Actually i am getting data from an API and i comparing with existing > values so i ld like to change only the changed fields.