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 retrieved from the cache. Since it's not attached to any session, when accessing a lazy-related object : >>> model2.owner I get a a DetachedInstanceError I found a turnaround : >>> DBSession().enable_relationship_loading(model2) >>> model2.owner that allows me to do what I want, but I'm not really satisfied with this design. Is it a clean way to go or should I review my caching strategy ? Thanks in advance, Regards Gaston Tjebbes http://www.majerti.fr -- 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.
