Re: [sqlalchemy] Query caching allows two objects representing same underlying data in session?

2013-07-16 Thread Claudio Freire
On Tue, Jul 16, 2013 at 4:22 PM, Michael Bayer wrote: >> To put a cached instance into a session, you must first copy it, then >> update. How to do that, is very application-specific, and I don't >> think it can be automated. > > that's what merge(don't_load=True) does. If your object has othe

Re: [sqlalchemy] Query caching allows two objects representing same underlying data in session?

2013-07-16 Thread Michael Bayer
On Jul 16, 2013, at 1:47 PM, Claudio Freire wrote: > On Mon, Jul 15, 2013 at 8:02 PM, Michael Bayer > wrote: >> On Jul 15, 2013, at 4:51 PM, Amir Elaguizy wrote: >> >>> I'm having this weird problem using the query caching recipes in which two >>> instances of a model representing the same

Re: [sqlalchemy] Query caching allows two objects representing same underlying data in session?

2013-07-16 Thread Claudio Freire
On Mon, Jul 15, 2013 at 8:02 PM, Michael Bayer wrote: > On Jul 15, 2013, at 4:51 PM, Amir Elaguizy wrote: > >> I'm having this weird problem using the query caching recipes in which two >> instances of a model representing the same underlying dataset will both get >> into the session. >> >> I k

Re: [sqlalchemy] Query caching allows two objects representing same underlying data in session?

2013-07-15 Thread Michael Bayer
On Jul 15, 2013, at 4:51 PM, Amir Elaguizy wrote: > I'm having this weird problem using the query caching recipes in which two > instances of a model representing the same underlying dataset will both get > into the session. > > I know this is happening because I put all of the models in a se