db: Avoid import variable shadowing

'session' is a widely used variable name in the glance.db.sqlalchemy.api
module and this is only going to increase over time. This shadowing
prevents easy identification of e.g. missing function parameters. Alias
the import and update the one call to avoid the need to rename all other
instances of the variable name.

Change-Id: I6b2cbf0b97bb3af7354f2c10a8d83909db963d43
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2023-07-19 17:44:19 +01:00
parent 5636008dfe
commit 1557eab368

View File

@ -27,7 +27,7 @@ import threading
from oslo_config import cfg
from oslo_db import exception as db_exception
from oslo_db.sqlalchemy import session
from oslo_db.sqlalchemy import session as oslo_db_session
from oslo_log import log as logging
from oslo_utils import excutils
import osprofiler.sqlalchemy
@ -82,7 +82,7 @@ def _create_facade_lazily():
if _FACADE is None:
with _LOCK:
if _FACADE is None:
_FACADE = session.EngineFacade.from_config(CONF)
_FACADE = oslo_db_session.EngineFacade.from_config(CONF)
if CONF.profiler.enabled and CONF.profiler.trace_sqlalchemy:
osprofiler.sqlalchemy.add_tracing(sqlalchemy,