Skip to content

Commit

Permalink
insertId is within the row, not the request.
Browse files Browse the repository at this point in the history
Fixes bug #134
  • Loading branch information
Jerjou Cheng committed Oct 29, 2015
1 parent 1ff6a5b commit 39de0c6
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 39de0c6

Please sign in to comment.