So I read this article that says inserting in blocks beats one row at a time:
Which is faster: multiple single INSERTs or one multiple-row INSERT?
And I read this article that suggests how to take rows of text and insert them into a mysql store:
How to use python mysqldb to insert many rows at once
My procedure goes like this:
- get vat of strings from input source
- pop out the few (10's) of chunks of interest
- populate an array with them, one chunk to one cell in a row
- repeat until the array is full
- try put the rows into the store with the input command
my problem is that when I try to use the following code for an array with ~100+ rows
cur.executemany("INSERT INTO OpStatus VALUES('?',?,...,?)", my_array)
I currently have one "?" for each column in the table.
It gives me the following error.
TypeError: not enough arguments for format string
My question is:
How do I reform my array or input statement so that I can make this a batch (not row) insert into the SQLITE table?
DISCLAIMER: It has been a few years since I used python. If you need to point me in a direction, or ask clarifying questions, please feel free.