I was trying to use executemany to insert values into a database, but it just won't work for me. Here is a sample:
clist = []
clist.append("abc")
clist.append("def")
clist.append("ghi")
cursor.executemany("INSERT INTO myTable(data) values (?) ", clist)
This gives me the following error:
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 3 supplied.
However, when I change the list, it works fine:
clist = ["a", "b"]
cursor.executemany("INSERT INTO myTable(data) values (?) ", clist)
It works as expected! I can see the data in the database. Why does the first list not work and second one does ?
(PS: This is just a sample and not the actual code. I made a small test case for simplicity).