Flask Update SQLite Record

flask, http, patch, python, sqlite

Solution

In SQLite, parameter placeholders are not `%s` but `?`.

Problem

Using Flask, I'm trying to implement HTTP `PATCH`. I am using SQLite. Here's what I have: ``` if 'name' in data.keys(): db.execute('UPDATE places SET name=%s WHERE id=%s', (str(data['name']), str(data_id))) ``` This yields the following error: `OperationalError: near "%": syntax error` What is wrong with my parametrisaton? I've looked up a few examples that pretty much look like this. I tried adding a % before the parameters parenthesis and that is also failing. I also tried concatenating using `+`'s but that also doesn't work.

Original source