[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
This commit is contained in:
Rodolfo Alonso Hernandez 2023-01-25 03:47:20 +01:00
parent 4cecce88c7
commit 59eebaa199
1 changed files with 3 additions and 3 deletions

View File

@ -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