[sqlalchemy] A long-lived ORM object

2012-02-08 Thread Michael Hipp
I have an ORM object that gets loaded once during program run and never changes. sess = Session() unchanging = sess.query(Unchanging).get(1) sess.close() # it is now detached I then need to tell other objects about about it, having a many-to-one relationship to 'unchanging': sess1 =

Re: [sqlalchemy] A long-lived ORM object

2012-02-08 Thread Michael Bayer
On Feb 8, 2012, at 10:29 AM, Michael Hipp wrote: I have an ORM object that gets loaded once during program run and never changes. sess = Session() unchanging = sess.query(Unchanging).get(1) sess.close() # it is now detached I then need to tell other objects about about it, having

Re: [sqlalchemy] A long-lived ORM object

2012-02-08 Thread Michael Hipp
On 2012-02-08 9:50 AM, Michael Bayer wrote: unchanging = sess1.merge(unchanging, dont_load=True) Thanks, Michael this seems to do what I need. But I notice in the docs the kwarg appears to be 'load=False'. Am I looking at the wrong thing?

Re: [sqlalchemy] A long-lived ORM object

2012-02-08 Thread Michael Bayer
oh right, the name changed at some point, that's correct. On Feb 8, 2012, at 3:07 PM, Michael Hipp wrote: On 2012-02-08 9:50 AM, Michael Bayer wrote: unchanging = sess1.merge(unchanging, dont_load=True) Thanks, Michael this seems to do what I need. But I notice in the docs the kwarg