Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions google/cloud/spanner_dbapi/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ def _do_batch_update(self, transaction, statements, many_result_set):
many_result_set.add_iter(res)

if status.code == ABORTED:
raise Aborted(status.details)
raise Aborted(status.message)
elif status.code != OK:
raise OperationalError(status.details)
raise OperationalError(status.message)

def execute(self, sql, args=None):
"""Prepares and executes a Spanner database operation.
Expand Down Expand Up @@ -302,9 +302,9 @@ def executemany(self, operation, seq_of_params):

if status.code == ABORTED:
self.connection._transaction = None
raise Aborted(status.details)
raise Aborted(status.message)
elif status.code != OK:
raise OperationalError(status.details)
raise OperationalError(status.message)
break
except Aborted:
self.connection.retry_transaction()
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/spanner_dbapi/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ def test_executemany_insert_batch_failed(self):

transaction = mock.Mock(committed=False, rolled_back=False)
transaction.batch_update = mock.Mock(
return_value=(mock.Mock(code=UNKNOWN, details=err_details), [])
return_value=(mock.Mock(code=UNKNOWN, message=err_details), [])
)

with mock.patch(
Expand Down