I'm trying to insert data into my database with python, but there's a syntax error in my query. I'm trying to get the code to take a list and be able to add the list into a row in a postgresql table. I've looked up some ways to add a list into a table and some of them had the '?' in it. I don't know what it means and I don't know why it might be causing the error. The error it's giving me is:
syntax error at or near ","
LINE 1: INSERT INTO TestTable VALUES (?, ?, ?, ?, ?, ?, ?);
Here's my code.
var_string = ', '.join('?' * len(items_list))
query_string = 'INSERT INTO TestTable VALUES (%s);' % var_string
cur.executemany(query_string, items_list)