SQLAlchemy: try except block on autocommit