chore: Cleanup database sessions (#10427)

Co-authored-by: John Bodley <john.bodley@airbnb.com>
This commit is contained in:
John Bodley
2020-07-30 23:07:56 -07:00
committed by GitHub
parent 7ff1757448
commit 7645fc85c3
39 changed files with 488 additions and 637 deletions

View File

@@ -132,8 +132,7 @@ def session_scope(nullpool: bool) -> Iterator[Session]:
)
if nullpool:
engine = sqlalchemy.create_engine(database_uri, poolclass=NullPool)
session_class = sessionmaker()
session_class.configure(bind=engine)
session_class = sessionmaker(bind=engine)
session = session_class()
else:
session = db.session()