I'm looking for a way in SQLAlchemy to do a bulk INSERT
whose rows are the result of a query. I know the session has the function add
which can be used to add an individual object, but I can't seem to find how how it works with a subquery.
I know I could iterate over the results of the subquery and add
them individually, but this would seem to be somewhat inefficient. In my case I am dealing with a potentially very large set of data that needs insertion.
I see following options:
I would suggest either option 1) or 3).
In fact, if you do not have any object validation and you use only one RDBMS, I would stick to option 3).