Python 2.7 and sqlite3
I create a table like this:
#create table
connector.execute('''CREATE TABLE mytable (
column1,
column2,
column3
''')
Then I iterate through a .csv file like this:
with open("mycsv.csv") as f:
for i in f:
del splitted[:]
del myData[:]
splitted = i.split(",")
for j in splitted:
myData.append(tuple([j]))
which gives me this output:
print myData
> [('testtext1',), ('testtext2',), ('testtext3\n',)]
However, when I try to insert this into my db like so:
connector.executemany('''INSERT INTO mytable (
column1,
column2,
column3
) VALUES (
?,?,?)''', myData)
I get the error
sqlite3.programmingerror incorrect number of bindings supplied. The current state uses 3, and tehre are 1 supplied.