Insert with where condition query web2py sqlite

26 views
Skip to first unread message

Alessio Varalta

unread,
May 28, 2015, 3:32:01 PM5/28/15
to web...@googlegroups.com
Hi i don't find on the guide the method to execute a query with where condition... i see 

db.class.insert but i don t find a method to use this with where condition or i use 

    db.executesql("Insert into auth_user('person') values(4) where auth_user.id=38;")

but i receive a error 

Anthony

unread,
May 28, 2015, 4:19:34 PM5/28/15
to web...@googlegroups.com, vara...@gmail.com
Inserts create new records, so there is no sense in which a "where" condition would apply. Perhaps instead you want to do an update to an existing record or set of records, in which case, see the .update() method of the Set class here: http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#The-DAL--A-quick-tour.

Anthony
Reply all
Reply to author
Forward
0 new messages