Don't expire objects on commit

This commit is contained in:
yuvipanda
2017-07-27 23:47:40 -07:00
committed by Min RK
parent 2517afcee0
commit 15e4b1ad8b

View File

@@ -599,5 +599,9 @@ def new_session_factory(url="sqlite:///:memory:", reset=False, **kwargs):
check_db_revision(engine) check_db_revision(engine)
Base.metadata.create_all(engine) Base.metadata.create_all(engine)
session_factory = sessionmaker(bind=engine) # We set expire_on_commit=False, since we don't actually need
# SQLAlchemy to expire objects after commiting - we don't expect
# concurrent runs of the hub talking to the same db. Turning
# this off gives us a major performance boost
session_factory = sessionmaker(bind=engine, expire_on_commit=False)
return session_factory return session_factory