Q:

SET working every other time Python MySQL

Im trying to set a value in my table with a given ID. When I run this code I am getting a return code of 1 on 'cursor.execute(updateStr)' the first time I run it, but it executes without issue and returns 0 when I run it a second time. There is no exception raised and I am not sure how to retrieve the actual error message. What could cause this problem and how do I dig deeper into the actual error? Thanks for looking.
updateStr = "UPDATE db.table SET OverrideVal = '{0}' WHERE table.OverrideID ={1};".format(overrideVal, overrideID)

returnCode = cursor.execute(updateStr)

if returnCode == 0:
    cursor.execute("COMMIT")
else:
    cursor.execute("ROLLBACK")

A:

I don't think the execute command returns anything meaningful.  Python's DB-API 2.0 states this about the execute method:

Return values are not defined.

Did you check to see if your updates are actually working?  (Be sure to commit them).

