SQLAlchemy 2.0: Remove use of autocommit

autocommit=True is no longer supported in SQLAlchemy 2.0

Change-Id: I40a0c2845ff39761ac977737e824e7dc05626340
This commit is contained in:
Ghanshyam Mann 2024-11-27 21:00:16 -08:00
parent d6ef9a22cd
commit db21cdedde

View File

@ -49,16 +49,14 @@ def setup():
Session = sessionmaker(bind=engine)
def get_session(autocommit=True, expire_on_commit=False):
def get_session(expire_on_commit=False):
"""Get a new sqlalchemy Session instance
:param bool autocommit: Enable autocommit mode for the session.
:param bool expire_on_commit: Expire the session on commit defaults False.
"""
global Session
setup()
session = Session(autocommit=autocommit,
expire_on_commit=expire_on_commit)
session = Session(expire_on_commit=expire_on_commit)
# if --verbose was specified, turn on SQL logging
# note that this is done after the session has been initialized so that