0

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

1 Answer 1

1

You should use db.query instead,like this results = db.query("UPDATE emp SET age=age+1 WHERE x=$x", vars={'x':1})

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks man. I had figure that out long back, but still there will be people like me. For future use ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.