Answers for "sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 4 supplied."

1

sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 7 supplied.

#Whats happening is that instead of getting the 1 datatype its looking for, 
#SQLite thinks its getting multiple. To solve this pass the data through as a 
#tuple, not on its own
cursor.execute('INSERT INTO images VALUES(?)', (data)) #should be
cursor.execute('INSERT INTO images VALUES(?)', (data,))
#To demonstrate, print the lengths of both of the options:
len(data)
>>>7
len(data,)
>>>1
Posted by: Guest on October-07-2020

Code answers related to "sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 4 supplied."

Python Answers by Framework

Browse Popular Code Answers by Language