@contextmanager
def session_scope(engine):
    Session.configure(bind=engine)
    session = Session()
    try:
        yield session
        session.commit()
    except:
        session.rollback()
        raise
    finally:
        session.close()
Provide a transactional scope around a series of operations.
dataset/ETHPy150Open jaysw/ipydb/ipydb/metadata/__init__.py/session_scope