Skip to content

Commit

Permalink
bigquery: retry Client.create_rows (#4178)
Browse files Browse the repository at this point in the history
  • Loading branch information
jba authored and tswast committed Oct 16, 2017
1 parent e031a29 commit 053a6ba
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bigquery/google/cloud/bigquery/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ def query(self, query, job_config=None, job_id=None, retry=DEFAULT_RETRY):

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

# TODO(jba): use self._call_api here after #4148 is merged.
response = self._connection.api_request(
# We can always retry, because every row has an insert ID.
response = self._call_api(
retry,
method='POST',
path='%s/insertAll' % table.path,
data=data)
Expand Down

0 comments on commit 053a6ba

Please sign in to comment.