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:
@@ -49,16 +49,14 @@ def setup():
|
|||||||
Session = sessionmaker(bind=engine)
|
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
|
"""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.
|
:param bool expire_on_commit: Expire the session on commit defaults False.
|
||||||
"""
|
"""
|
||||||
global Session
|
global Session
|
||||||
setup()
|
setup()
|
||||||
session = Session(autocommit=autocommit,
|
session = Session(expire_on_commit=expire_on_commit)
|
||||||
expire_on_commit=expire_on_commit)
|
|
||||||
|
|
||||||
# if --verbose was specified, turn on SQL logging
|
# if --verbose was specified, turn on SQL logging
|
||||||
# note that this is done after the session has been initialized so that
|
# note that this is done after the session has been initialized so that
|
||||||
|
Reference in New Issue
Block a user