I was trying to update a table in SQLite database and this worked for me.
def test_update(self): conn = sqlite3.connect('test.sqlite') cur = conn.cursor() params = ('buhi', 'buhi', 1) cur.execute('''UPDATE HOGE SET col1 = ?, col2 = ? WHERE id = ? ''', params) conn.commit()
As you can see, all the parameters can be passed as a tuple and the ?’s represent the values that will be replaced by the actual values.
The last line of the code will actually updates the data in the database.