I have a fairly large array that I am trying to insert into an SQL table. I would like to do this without using loops.
For an array:
arr = np.array([['a',1,2],['b',3,4], ...])
I am trying to insert it:
db.execute("""INSERT INTO table(column1, column2, column3)
VALUES (%s)"""% (','.join('?'*len(arr))), arr)
However, this raises the error that I am trying to insert 100 values for 3 columns.
What would be the correct way of writing this?