Re: [sqlalchemy] Handling detached instances

2014-10-01 Thread Wichert Akkerman
On 30 Sep 2014, at 23:18, tonthon tontho...@gmail.com wrote: I didn't knew merge was supposes to be used in such a case, it works like a charm. Following that tip, I've added this decorator : def cache_wrapper(func): ensure a model returned from a cached function

[sqlalchemy] Handling detached instances

2014-09-30 Thread tonthon
Hi, I'm using dogpile cache to store objects in a redis database, here's the sample function I use for my tests : @region.cache_on_arguments() def get_my_model(id): return DBSession().query(Model).get(id) I retrieve models : model1 = get_my_model(5) model2 = get_my_model(5) model2 is

Re: [sqlalchemy] Handling detached instances

2014-09-30 Thread Simon King
On Tue, Sep 30, 2014 at 8:52 AM, tonthon tontho...@gmail.com wrote: Hi, I'm using dogpile cache to store objects in a redis database, here's the sample function I use for my tests : @region.cache_on_arguments() def get_my_model(id): return DBSession().query(Model).get(id) I retrieve

Re: [sqlalchemy] Handling detached instances

2014-09-30 Thread tonthon
Le mardi 30 septembre 2014 13:28:16 UTC+2, Simon King a écrit : On Tue, Sep 30, 2014 at 8:52 AM, tonthon tont...@gmail.com javascript: wrote: Hi, I'm using dogpile cache to store objects in a redis database, here's the sample function I use for my tests :