From 1557eab3687713f05a7711645c68c04e13512847 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Wed, 19 Jul 2023 17:44:19 +0100 Subject: [PATCH] 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 --- glance/db/sqlalchemy/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glance/db/sqlalchemy/api.py b/glance/db/sqlalchemy/api.py index d01503fc59..9bd84f78ef 100644 --- a/glance/db/sqlalchemy/api.py +++ b/glance/db/sqlalchemy/api.py @@ -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,