You have to loop:

for row in db(db.table.id>0).select():
    row.update_record(x=row.x+1)

It is going to be slow and not transaction safe.

On Dec 1, 3:11 pm, yamandu <yamandu.co...@gmail.com> wrote:
> Could anyone here throw some light on this subject?
> I think GQL has no update statement and Web2py does not support
> expressions.
> So what´s the propper way to (batch) update records?
> I mean in the case like that:
>
> db.define_table('tabela',
>                       Field('x',integer) )
>
> Suppose I want to increment the value in x for a set of records.
>
> Would db(db.tabela.id>0).update(x='x+10') work on GAE ?

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to