How do I detach or unload the data from a relation on an instance?

I'm writing a thin layer on top of SA for caching and need to do
serialization.  The following happens when serializing:

poet = session.query(Poet).find_by(name='Haafez').one()
pickle.dumps(poet)  # Only serializes the Poet object

poet.poems  # Access a relation
pickle.dumps(poet)  # Serializes Poet object and list of Poems

I need to detach the relations and cache them separately.  Any
recommendations?

--

You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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.


Reply via email to