SQL Alchemy, how to insert data into two tables and reference foreign key?
问题 I am inserting a list of python dictionaries into a Postgres database using SQL Alchemy (via Flask_sqlalchemy). One of the tables is a list of all unique items (table 1), while the second is a time series of data related to an item (table2). In essence, I want to insert any new row (with unique hash) in to table 1, then insert it's data to table 2. If it already exists in table 1, just insert the "child" in table 2 referencing the entry in table 1. This is one item in the list, the list has a