Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 95908f6

Browse filesBrowse files
author
Ilya Gurov
authored
feat(db_api): raise exception with message for executemany() (#595)
1 parent 828df62 commit 95908f6
Copy full SHA for 95908f6

File tree

Expand file treeCollapse file tree

2 files changed

+5
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-5
lines changed

‎google/cloud/spanner_dbapi/cursor.py

Copy file name to clipboardExpand all lines: google/cloud/spanner_dbapi/cursor.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ def _do_batch_update(self, transaction, statements, many_result_set):
160160
many_result_set.add_iter(res)
161161

162162
if status.code == ABORTED:
163-
raise Aborted(status.details)
163+
raise Aborted(status.message)
164164
elif status.code != OK:
165-
raise OperationalError(status.details)
165+
raise OperationalError(status.message)
166166

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

303303
if status.code == ABORTED:
304304
self.connection._transaction = None
305-
raise Aborted(status.details)
305+
raise Aborted(status.message)
306306
elif status.code != OK:
307-
raise OperationalError(status.details)
307+
raise OperationalError(status.message)
308308
break
309309
except Aborted:
310310
self.connection.retry_transaction()

‎tests/unit/spanner_dbapi/test_cursor.py

Copy file name to clipboardExpand all lines: tests/unit/spanner_dbapi/test_cursor.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ def test_executemany_insert_batch_failed(self):
506506

507507
transaction = mock.Mock(committed=False, rolled_back=False)
508508
transaction.batch_update = mock.Mock(
509-
return_value=(mock.Mock(code=UNKNOWN, details=err_details), [])
509+
return_value=(mock.Mock(code=UNKNOWN, message=err_details), [])
510510
)
511511

512512
with mock.patch(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.