On Nov 18, 2012, at 1:29 AM, sajuptpm wrote: > Hi, > > Getting error when nesting scoped_session > > http://stackoverflow.com/questions/13330245/how-to-use-nested-transaction-with-scoped-session-in-sqlalchemy > https://groups.google.com/forum/?fromgroups=#!topic/sqlalchemy/E8QEtj35TEY
answer posted there: unless SAVEPOINT is being used, which is not the case here, session.rollback() rolls back the entire transaction, regardless of nesting. The purpose of nesting with "subtransactions" is so that several blocks of code can each specify that they "begin()" and "commit()" a transaction, independently of whether or not one of those methods calls the other. It is only the **outermost** begin()/commit() pair that has any effect, so the code here is equivalent to there being **no** begin()/commit() call in method_b() at all. The "subtransactions" pattern exists mostly for the purposes of framework integrations and is not intended for general use. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" 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/sqlalchemy?hl=en.
