Remove usage of LegacyEngineFacade
This helper class of oslo.db was deprecated long time ago Change-Id: Ibdc6e3aa5fa3b729a95356f27ee9f6dab1eef3c7
This commit is contained in:
parent
71387ff122
commit
01018c1b1e
|
@ -47,7 +47,7 @@ import time
|
|||
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_db import options as db_options
|
||||
from oslo_db.sqlalchemy import session as db_session
|
||||
from oslo_db.sqlalchemy import enginefacade
|
||||
import sqlalchemy as sa
|
||||
import sqlalchemy.orm # noqa
|
||||
|
||||
|
@ -71,14 +71,19 @@ def _create_facade_lazily():
|
|||
global _FACADE
|
||||
|
||||
if _FACADE is None:
|
||||
_FACADE = db_session.EngineFacade.from_config(CONF)
|
||||
ctx = enginefacade.transaction_context()
|
||||
ctx.configure(
|
||||
sqlite_fk=False,
|
||||
__autocommit=False,
|
||||
expire_on_commit=False
|
||||
)
|
||||
_FACADE = ctx
|
||||
|
||||
return _FACADE
|
||||
|
||||
|
||||
def get_engine():
|
||||
facade = _create_facade_lazily()
|
||||
return facade.get_engine()
|
||||
return _create_facade_lazily().writer.get_engine()
|
||||
|
||||
|
||||
def get_session():
|
||||
|
|
1
tox.ini
1
tox.ini
|
@ -143,7 +143,6 @@ commands = \
|
|||
[pytest]
|
||||
filterwarnings =
|
||||
error
|
||||
ignore:.*EngineFacade is deprecated; please use oslo_db.sqlalchemy.enginefacade*:
|
||||
# Introduced with oslo.db-12.1.0
|
||||
ignore:.*Support for the MySQL NDB Cluster storage engine has been deprecated and will be removed in a future release.:DeprecationWarning:
|
||||
# Introuduced with SQLAlchemy-1.4.46, can be removed when rally supports SQLAlchemy>=2.0.0
|
||||
|
|
Loading…
Reference in New Issue