Skip to content
Merged
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
20 changes: 9 additions & 11 deletions src/python/google_cloud_utils/big_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,16 +383,14 @@ def insert(self, inserts):
if not result:
# Use result from the first batch, appending errors from the rest.
result = response
else:
# If there are new errors from the current batch, append to the result.
new_errors = response.get('insertErrors')
if not new_errors:
continue

# Apparently result may not have errors, be careful.
if result.get('insertErrors'):
result['insertErrors'].extend(new_errors)
else:
result['insertErrors'] = new_errors
continue

# If there are new errors from the current batch, append to the result.
new_errors = response.get('insertErrors')
if not new_errors:
continue

# Apparently result may not have errors, use |setdefault| to be careful.
result.setdefault('insertErrors', []).extend(new_errors)

return result