Reputation: 164
I want the below query to implement in webpy using db.update
update emp set age=age+1 where x=1`
When i tried
db.update('emp',where='x=1',age=age+1)
This throw me an error saying global name 'age' is not defined
Upvotes: 0
Views: 88
Reputation: 1081
You should use db.query
instead,like this
results = db.query("UPDATE emp SET age=age+1 WHERE x=$x", vars={'x':1})
Upvotes: 1