I have a very long list of values:
mylist = [1, 2, 3, 4, 5, 6 .......]
and the following query to insert them in to postgres database:
connection.execute(
'INSERT INTO data_core_cftcreport VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s, %s)',
mylist)
This works as expected however it doesn't look good....
My question: Is there any way I can shorten the VALUES declaration?
I tried to do this, kind of borrowing from MySql, but it didn't work:
connection.execute('INSERT INTO data_core_cftcreport VALUES %s', mylist)