mercredi 23 mars 2016

Insert tuple in sqlite request

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.

Aucun commentaire:

Enregistrer un commentaire