I don't think you can accomplish this with pyramid_tm being used.

My initial response was going to be this:

    since session_1 is readonly, don't configure it to join the 
pyramid_tm/zope transaction.  Then just rollback session_1 when session_2 
commits.     

but session_2 is going to commit as part of the pyramid_tm tween - so you 
don't have control over that.

you could have a tween running over pyramid_tm that applies a rollback onto 
session_1, but the tweens happen after rendering in the pyramid 
lifecycle... so that's not going to work either.

visually, here's the pyramid request lifecycle 
- https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/router.html

the commit on session_2 is happening in the tween_egress, but the rendering 
is happening in the view_pipeline above it.

i think the only way you can accomplish easily is without using the 
transaction manger.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to