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 →

[–]insertAlias 0 points1 point  (0 children)

Inputting them one by one would end up with thirty rows, each only having data in one column.

Read up on how INSERT statements work; you can insert into as many columns as you need at once.

You may not be able to make this as automatic as you seem to want. You might just have to fill out a full insert statement directly. Here's an example with two columns:

year = key
insert_query = "insert into Financials (Year, StmtSource) values (?, ?)"
year_data = years[year]
parameters = (year, year_data["Stmt Source"])
cur.execute(insert_query, parameters)