This is my Python code -
cursor.execute("""UPDATE tasks SET task_owner=%s,task_remaining_hours=%s, task_impediments=%s,task_notes=%s WHERE task_id=%s""", (new_task_owner,new_task_remaining_hours,new_task_impediments,
new_task_notes,task_id))
This is the SQL statement I try in SQLite3 manager (Firefox extension)
UPDATE tasks SET task_owner=%s,task_remaining_hours=%d,task_impediments=%s,task_notes=%s WHERE task_id=%d,("sumod",10,"none","test",1)
The error I get is -
sqlite3.OperationalError: near "%": syntax error
I have tried many web searches including SO, tutorials and self-troubleshooting, but this error does not go away. What exactly I am doing wrong here.
I believe Python's SQLite implementation uses ?
placeholders, unlike MySQLdb's %s
. Review the documentation.
cursor.execute("""UPDATE tasks SET task_owner = ? ,task_remaining_hours = ?,task_impediments = ?,task_notes = ? WHERE task_id= ? """,
(new_task_owner,new_task_remaining_hours,new_task_impediments,new_task_notes,task_id))
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