# I've set echo=True when doing create_engine, so I can see all the sql stmt
# DBSession is ScopeSession(thread_local) and autocommit is False
session = DBSession() 
session.add(somemodel)
# 
try:
    session.flush()
    raise Exception()
    session.commit()
except SQLAlchemyError as e:
    session.rollback()
finally:
    session.close()
SQLAlchemy docs によると:
The close() method issues a expunge_all(), and releases any transactional/connection
resources. When connections are returned to the connection pool, transactional state is
rolled back as well.
「session.close()」を実行すると、ログ「ロールバック」が表示されることを期待しています