0

I have selected_comments which is a tuple of id that I want to remove from the sqlite3 database. I tried this command (and other variations):

cursor.execute("DELETE FROM comments WHERE id IN (?)",(selected_comments)) 

But I get errors (for this specific command, I have: sqlite3.ProgrammingError: Incorrect number of bindings supplied.).

The size of the tuple is not fixed: it can go from 1 element to as much as you want.

4
  • did you try putting it as just selected_comments and not (selected_comments)? Commented Mar 23, 2016 at 14:53
  • Yes. And with ? as well. Commented Mar 23, 2016 at 14:57
  • Have you tried (selected_comments,) instead of (selected_comments). Commented Mar 23, 2016 at 15:15
  • It was my first try. But selected_comments is already a tuple, so there is no need to add the comma. Commented Mar 23, 2016 at 15:45

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.