From 59eebaa19960494882c854b1efeb7816e532ce9a Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Wed, 25 Jan 2023 03:47:20 +0100 Subject: [PATCH] [sqlalchemy-20] Use ``Session.get_transaction()`` "transaction" is no longer a public member in ``Session`` class. The method ``get_transaction`` should be used instead. Change-Id: I182dcd2f4ff9d6d0d1092c8f9967b4a5cc063242 Closes-Bug: #2004260 --- neutron_lib/db/api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/neutron_lib/db/api.py b/neutron_lib/db/api.py index 8a938c20b..c9d0157a2 100644 --- a/neutron_lib/db/api.py +++ b/neutron_lib/db/api.py @@ -309,7 +309,7 @@ def _load_one_to_manys(session): if session.new: session.flush() - if session.transaction.nested: + if session.get_transaction().nested: # wait until final commit return @@ -479,8 +479,8 @@ def is_session_active(session): if getattr(session, 'autocommit', None): # old behaviour, to be removed with sqlalchemy 2.0 return session.is_active - if not session.transaction: + if not session.get_transaction(): return False - if not session.transaction._connections: + if not session.get_transaction()._connections: return False return True