On Dec 9, 2013, at 11:20 PM, Jonathan Rogers <jonathanrrog...@gmail.com> wrote:

> 
> I want to cache mapped objects from rows which will not change during the 
> process lifetime of a web application, so I used the memory backend. Based on 
> the comment in the example from SQLAlchemy  0.7.9, I have also implemented 
> this approach of caching detached objects. It mostly works fine. However, 
> sometimes objects lazily loaded from a collection relationship and cached via 
> RelationshipObject are still detached when the application code gets them. It 
> looks like CachingQuery.get_value() should make sure any objects loaded from 
> the cache are merged, but somehow that's not happening.


the object coming out of merge() shouldn’t have anything detached associated 
with it - it either merges along the relationship paths, or it doesn’t and 
those relationships come out unloaded.  is this something you can distill down 
to a test case ?    



> 
> The web application is a single-threaded, long lived process which maintains 
> one Session object for its entire lifetime, repeatedly committing or rolling 
> back for each HTTP request. I'm only seeing the detached objects on the 
> request to a given process so it seems that objects loaded from the database 
> for inserting into the cache are staying detached but those fetched from the 
> cache on subsequent requests are properly merged. Do you have any idea why 
> this would be or where I should investigate?
> 
> -- 
> 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 tosqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/groups/opt_out.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to