Skip to content
Advertisement

Not all parameters were used in the SQL statement Python – MySql

I want to check if the ID exists already but I get this error:

Not all parameters were used in the SQL statement

Code:

JavaScript

Advertisement

Answer

The second argument to execute() should be a sequence of values, one for each placeholder token %s in the query.

You did pass a sequence, but not in the way you intended. Strings are sequences, so you actually passed a sequence of four values – T, E, S, T, which is too many values, because the query only has one placeholder token.

Pass the string as a one-element tuple, like so:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement