I have about 140 columns in my database. I'm going to write to them all at once, and have stored all the columns in a list.
However, if I do something like:
c_all.execute('''INSERT OR IGNORE INTO match('''+sql_column_string+''') VALUES ('''+sql_write_qmark''')''',(columns,))
Where sql_column_string is all 140 columns formatted like column1, column2, ... and the sql_write_qmark as 140 '?,'
Then I find it moans claims:
ProgrammingError: Incorrect number of bindings supplied. The current statement uses 140, and there are 1 supplied.
It's correctly realising I want 140 columns, and indeed len(columns) yields 140, but it takes it as only 1 argument.
I need to somehow expand columns into being 140 bindings. I've tried tuple(columns), I've tried (column for column in columns) but each time it gives me the same error.
How can I get it to treat the list as 140 bindings, not one?
Aucun commentaire:
Enregistrer un commentaire