Skip to content

Commit 053a6ba

Browse files
jbatswast
authored andcommitted
bigquery: retry Client.create_rows (googleapis#4178)
1 parent e031a29 commit 053a6ba

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

bigquery/google/cloud/bigquery/client.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ def query(self, query, job_config=None, job_id=None, retry=DEFAULT_RETRY):
906906

907907
def create_rows(self, table, rows, row_ids=None, selected_fields=None,
908908
skip_invalid_rows=None, ignore_unknown_values=None,
909-
template_suffix=None):
909+
template_suffix=None, retry=DEFAULT_RETRY):
910910
"""API call: insert table data via a POST request
911911
912912
See
@@ -958,6 +958,9 @@ def create_rows(self, table, rows, row_ids=None, selected_fields=None,
958958
on the schema of the template table. See
959959
https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables
960960
961+
:type retry: :class:`google.api.core.retry.Retry`
962+
:param retry: (Optional) How to retry the RPC.
963+
961964
:rtype: list of mappings
962965
:returns: One mapping per row with insert errors: the "index" key
963966
identifies the row, and the "errors" key contains a list
@@ -1006,8 +1009,9 @@ def create_rows(self, table, rows, row_ids=None, selected_fields=None,
10061009
if template_suffix is not None:
10071010
data['templateSuffix'] = template_suffix
10081011

1009-
# TODO(jba): use self._call_api here after #4148 is merged.
1010-
response = self._connection.api_request(
1012+
# We can always retry, because every row has an insert ID.
1013+
response = self._call_api(
1014+
retry,
10111015
method='POST',
10121016
path='%s/insertAll' % table.path,
10131017
data=data)

0 commit comments

Comments
 (0)