Transaction within transaction
Posted
by user281521
on Stack Overflow
See other posts from Stack Overflow
or by user281521
Published on 2010-02-25T19:28:44Z
Indexed on
2010/06/17
6:03 UTC
Read the original article
Hit count: 235
Hello, I want to know if open a transaction inside another is safe and encouraged?
I have a method:
def foo():
session.begin
try:
stuffs
except Exception, e:
session.rollback()
raise e
session.commit()
and a method that calls the first one, inside a transaction:
def bar():
stuffs
try:
foo() #<<<< there it is :)
stuffs
except Exception, e:
session.rollback()
raise e
session.commit()
if I get and exception on the foo method, all the operations will be rolled back? and everything else will work just fine? thanks!!
© Stack Overflow or respective owner