Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Incorrect number of bindings supplied. The current statement uses 1, and there are 3 supplied.

#You need to pass in a sequence, comma at the end:
cursor.execute('SELECT * FROM TABLE WHERE COL = ?;', (string,))
Comment

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
Comment

PREVIOUS NEXT
Code Example
Python :: how to check which python version is installed 
Python :: python zfill 
Python :: import QMessageBox PyQt5 
Python :: how to get RGB value from pixel in screen live python 
Python :: python remove duplicates from 2d list 
Python :: libreoffice add line in table 
Python :: punctuation list python 
Python :: how to add row in spark dataframe 
Python :: what is my python working directory 
Python :: get ip address in django 
Python :: python number to letter 
Python :: django RetrieveUpdateDestroyAPIView 
Python :: python program to display the current date and time 
Python :: python for loop max iterations 
Python :: print 2d array in python 
Python :: difference between sort and sorted 
Python :: pandas replace zero with blank 
Python :: jupyter notebook make new lines 
Python :: how to convert string to byte without encoding python 
Python :: qmessagebox icon pyqt5 
Python :: convert array to list python 
Python :: get last day of month python 
Python :: How to set font size of Entry in Tkinter 
Python :: gnome-shell turn off 
Python :: convert xml to dataframe python 
Python :: sort dictionary 
Python :: pandas delete first row 
Python :: json.dumps no spaces 
Python :: blank=True 
Python :: install lz4 python 3 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =