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 serach for multiple attributes in xpath selenium python 
Python :: how to create a button using tkinter 
Python :: pandas how to drop rows with extreme values in a single column 
Python :: python max value in list 
Python :: python recognize every white color 
Python :: pytube get highest resolution 
Python :: flask rest api upload image 
Python :: decision tree classifier python code for visualization 
Python :: help() function in python 
Python :: python get index of substring in liast 
Python :: pass 2d array to 1d python 
Python :: unsupervised knn 
Python :: add row to dataframe with index 
Python :: Python Changing a Tuple 
Python :: arange float step 
Python :: intersection of three arrays 
Python :: codechef solution 
Python :: how to print 2 list in python as table 
Python :: print all elements in list python 
Python :: cache pyspark 
Python :: create tuples python 
Python :: django exclude queryset 
Python :: Python Create a nonlocal variable 
Python :: merge two sorted arrays python 
Python :: seaborn and matplotlib python 
Python :: Python basic discord bot 
Python :: promises in python 
Python :: How to efficiently determine if a search pattern is part of some target string, in Python? 
Python :: how to iterate set in python 
Python :: matplotlib save figure without showing 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =