hi michael, thank you very much for your response. i have read the beaker cache examples but i am yet to grasp it. the current solution i have found is querying the relationships as well with the joinedload() and caching the result.
after i fully understand what is going on and how to do it better with the examples, i will do a blog post. thanks again. On 25 Aralık, 01:04, Michael Bayer <mike...@zzzcomputing.com> wrote: > On Dec 24, 2011, at 5:38 PM, Mengu wrote: > > > hi all. i am caching my query results in redis with > > sqlalchemy.ext.serializer.loads/dumps. like results = > > DBSession.query(ShowContestant).all() and redis.set(key, > > dumps(results)) > > > when i do loads(redis.get(key)) i get the obj without any problems but > > if i want to access any of its relations, i get this error: > > DetachedInstanceError: Parent instance <ShowContestant at > > 0x7f532403b1d0> is not bound to a Session; lazy load operation of > > attribute 'videos' cannot proceed. > > > how can i fix this? please also let me know if i'm doing this proper > > or not. > > You need to merge the objects back in. See how the Beaker caching example > does this, it's in the distro and introduced > athttp://www.sqlalchemy.org/docs/orm/examples.html?highlight=beaker#bea.... -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.