I'm having a bit of trouble. Let's say I have N primary key IDs for a set of objects. I want to load all of those objects into the session, but I'd like that to happen all in one query.
dbsess.query(object_type).filter(object_type.primary_key.in_(some_list_of_ids)).all() # then I made (one or more) new instances using the same primary key as above new_instance = object_type(....) # NOTE: includes the primary key dbsess.merge( new_instance ) # this issues another query to load using the primary key. Instead of issuing N queries, I'd like to find a way to load the session with all of the objects I'm (eventually) going to call merge on, and have that happen in just one query if possible. I tried using merge_result but I'm pretty sure I'm not using it properly. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
