Reputation: 11640
With python sqlite3, I'd like to something like
cursor.execute('SELECT * FROM songs WHERE filename LIKE "?%"', (key_string,))
so that I can use the key as a variable instead of having to hard code the pattern. But this does not work and gives me:
ProgrammingError: Incorrect number of bindings supplied. The current statement uses 0, and there are 1 supplied.
Please help.
Upvotes: 1
Views: 2041
Reputation: 11640
Figured out the answer my self:
cursor.execute('SELECT * FROM songs WHERE filename LIKE ?', ('{}%'.format(key_string),))
Upvotes: 2