I use Python 2.7 and pypyodbc in order to run SQL queries but whenever I run the update query using python,
cursor.execute("UPDATE tbl_User SET gender = ? WHERE id = 1", ['male'])
I get the error:
TypeError: string or integer address expected instead of instance instance
The same query works if I run it directly on SQL Server.
The problem was I didn't put a semicolon at the end of the query. The solution is:
cursor.execute("UPDATE tbl_User SET gender = ? WHERE id = 1;", ['male'])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With