Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rollback failed exception log #106

Merged
merged 9 commits into from
Sep 10, 2021
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 8 additions & 7 deletions google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,13 +798,14 @@ def do_rollback(self, dbapi_connection):
To prevent rollback exception, don't rollback
committed/rolled back transactions.
"""
if (
not isinstance(dbapi_connection, spanner_dbapi.Connection)
and dbapi_connection.connection._transaction
and (
dbapi_connection.connection._transaction.rolled_back
or dbapi_connection.connection._transaction.committed
)
if isinstance(dbapi_connection, spanner_dbapi.Connection):
dbapi_connection = dbapi_connection
IlyaFaer marked this conversation as resolved.
Show resolved Hide resolved
else:
dbapi_connection = dbapi_connection.connection

if dbapi_connection._transaction and (
dbapi_connection._transaction.rolled_back
or dbapi_connection._transaction.committed
):
pass
else:
Expand Down