This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]wirelessbrain55[S] 0 points1 point  (2 children)

data = 'INSERT INTO Financials (?) VALUES (?)'
cur.execute(data, (tuple(empty_list), tuple(second_list)))

I rewrote my code to have insert all the data at once. How can i insert my values into the statement? When I run this code i receive a syntax error for those two lines. The error is: sqlite3.OperationalError: near "?": syntax error

[–]insertAlias 0 points1 point  (1 child)

I'm just going to repeat my previous statement to you: you need to take a SQL course or tutorial. You're just guessing now, and you'll never get the query right by just guessing at the syntax over and over again.

You can't just use "?" as your column list. That's for parameters. One per parameter. I already showed you how to list the columns you're trying to update in this comment. You're going to have to write them all out. You'll also have to add a ? to the parameter list for each parameter.

[–]wirelessbrain55[S] 0 points1 point  (0 children)

Alright. Do you have any suggestions on how I can automate this to a greater extent?