For example, is there a difference between the following two?
session = Session() # Session is a session maker
try:
# do some work
session.commit()
except:
session.rollback()
finally:
session.close()
and
session = Session()
try:
# do some work
session.commit()
finally:
session.close()
The latter is what I used to do, because I assumed closing the session before committing (in case of an error) had the same effect as rolling back. But I saw the first form here.