Merge "db: turn off autocommit"

This commit is contained in:
Zuul 2024-04-05 21:50:51 +00:00 committed by Gerrit Code Review
commit 78272c7570
3 changed files with 3 additions and 12 deletions

View File

@ -73,11 +73,10 @@ _DEFAULT_SQL_CONNECTION = 'sqlite://'
db_options.set_defaults(cfg.CONF,
connection=_DEFAULT_SQL_CONNECTION)
context_manager = enginefacade.transaction_context()
# FIXME(stephenfin): we need to remove reliance on autocommit semantics ASAP
# since it's not compatible with SQLAlchemy 2.0
context_manager.configure(__autocommit=True)
context_manager.configure()
def get_engine():

View File

@ -28,11 +28,10 @@ class Query(orm.Query):
return super(Query, self).soft_delete(synchronize_session)
def get_maker(engine, autocommit=True, expire_on_commit=False):
def get_maker(engine, expire_on_commit=False):
"""Return a SQLAlchemy sessionmaker using the given engine."""
return sqlalchemy.orm.sessionmaker(bind=engine,
class_=orm.Session,
autocommit=autocommit,
expire_on_commit=expire_on_commit,
query_cls=Query)

View File

@ -186,13 +186,6 @@ class WarningsFixture(fixtures.Fixture):
category=sqla_exc.SADeprecationWarning,
)
warnings.filterwarnings(
'ignore',
module='manila',
message='The current statement is being autocommitted ',
category=sqla_exc.SADeprecationWarning,
)
warnings.filterwarnings(
'ignore',
module='manila',