On Oct 21, 2011, at 3:54 PM, Denis wrote:

> 
> Is there any way for me to share the pending objects of the serialized
> session with the read session? I would like to ensure that the read
> session used in the same request as the serialized session sees the
> same data.

A single object can only be linked to one Session at a time.  You can transfer 
state to another while leaving the original unaffected using Session.merge().  
If the objects themselves are persistent (i.e. have an id) and are clean (i.e 
have been flushed, no pending changes) you can use myobj = merge(obj, 
load=False) which will skip the SQL lookup, if performance is what you're going 
for here.

> 
> 
> I can't simply commit the serialized session myself, because I do want
> zope.sqlalchemy to ensure that everything is rolled back if there's
> any exception during the request.
> 
> And I also have to avoid reading from the serialized session as much
> as possible because it increases the change of postgres blocking.

Have you considered working primarily with the non-serialiazed session, then 
using merge() into the serialized one just for persistence ?  that might be 
easier.  merge() works well but if you're using it very heavily you might find 
some quirks.


-- 
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.

Reply via email to