Re: [sqlalchemy] How to correctly merge objects of type X or any subclass of type X into the session?

2016-02-16 Thread Mike Bayer
On 02/16/2016 11:42 AM, Michael Naber wrote: That's interesting. So, if I'm trying to move instances between threads, is it recommended that I pass between threads the instance id, and then in the receiving thread use session.query(Person).get(instance_id), or... should I pass the instance

Re: [sqlalchemy] How to correctly merge objects of type X or any subclass of type X into the session?

2016-02-16 Thread Michael Naber
That's interesting. So, if I'm trying to move instances between threads, is it recommended that I pass between threads the instance id, and then in the receiving thread use session.query(Person).get(instance_id), or... should I pass the instance itself (not by ID), and then use

Re: [sqlalchemy] How to correctly merge objects of type X or any subclass of type X into the session?

2016-02-16 Thread Mike Bayer
answered On 02/16/2016 09:08 AM, Michael Naber wrote: I would like to write code which can correctly merge objects of type X or any subclass of type X into the session. I have been doing session.merge(X(id=??)), which works fine for merging type X, but if the object ID references an instance

[sqlalchemy] How to correctly merge objects of type X or any subclass of type X into the session?

2016-02-16 Thread Michael Naber
I would like to write code which can correctly merge objects of type X or any subclass of type X into the session. I have been doing session.merge(X(id=??)), which works fine for merging type X, but if the object ID references an instance of any subclass of X, the merge results in the