On Nov 15, 2011, at 7:09 AM, Vlad K. wrote:

> 
> 
> Why I didn't think of this earlier? Transaction complains if you use 
> session.commit() or session.begin_nested() directly, wants you to use 
> transaction.commit() and transaction.savepoint() instead and it just didn't 
> occur to me to try session.rollback() nevertheless (and in my mind 
> transaction.abort() == session.rollback() which now I see is NOT the same), 
> and trying savepoint.rollback() fails, I assumed session.rollback() was 
> called by Transaction since the SQL debug output clearly shows savepoint 
> rollback being emitted, so I went to search for another solution.
> 
> Aside from me being silly for not trying this before (and it is even 
> suggested by the InvalidRequestError!), it is a bit illogical to have to use 
> transaction.savepoint() and then use session.rollback() instead of 
> savepoint.rollback().


glad you figured this out.   Now we need to adjust zope.sqlalchemy's API and/or 
documentation so that the SAVEPOINT use case is made clear.    I would think 
that since SAVEPOINTs can be per-connection,  perhaps zope.sqlalchemy would 
support begin_nested() on individual sessions...or maybe not.   


-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to