Skip to content

Commit

Permalink
Merge pull request #135 from GoogleCloudPlatform/insertid
Browse files Browse the repository at this point in the history
insertId is within the row, not the request.
  • Loading branch information
Jonathan Wayne Parrott committed Oct 29, 2015
2 parents 1ff6a5b + 39de0c6 commit fbb6e6f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bigquery/api/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@
# [START stream_row_to_bigquery]
def stream_row_to_bigquery(bigquery, project_id, dataset_id, table_name, row,
num_retries=5):
# Generate a unique row id so retries
# don't accidentally duplicate insert
insert_all_data = {
'insertId': str(uuid.uuid4()),
'rows': [{'json': row}]
'rows': [{
'json': row,
# Generate a unique id for each row so retries don't accidentally
# duplicate insert
'insertId': str(uuid.uuid4()),
}]
}
return bigquery.tabledata().insertAll(
projectId=project_id,
Expand Down

0 comments on commit fbb6e6f

Please sign in to comment.