Skip to content

Commit 809e6ab

Browse files
author
Ilya Gurov
authored
fix: rollback failed exception log (#106)
1 parent b5e1a21 commit 809e6ab

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -800,13 +800,12 @@ def do_rollback(self, dbapi_connection):
800800
To prevent rollback exception, don't rollback
801801
committed/rolled back transactions.
802802
"""
803-
if (
804-
not isinstance(dbapi_connection, spanner_dbapi.Connection)
805-
and dbapi_connection.connection._transaction
806-
and (
807-
dbapi_connection.connection._transaction.rolled_back
808-
or dbapi_connection.connection._transaction.committed
809-
)
803+
if not isinstance(dbapi_connection, spanner_dbapi.Connection):
804+
dbapi_connection = dbapi_connection.connection
805+
806+
if dbapi_connection._transaction and (
807+
dbapi_connection._transaction.rolled_back
808+
or dbapi_connection._transaction.committed
810809
):
811810
pass
812811
else:

0 commit comments

Comments
 (0)