Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BQ: Empty array when no results #184

Merged
merged 2 commits into from
Feb 16, 2016
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
6 changes: 5 additions & 1 deletion bigquery/api/sync_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,21 @@ def main(project_id, query, timeout, num_retries):

# [START paging]
# Page through the result set and print all results.
results = []
page_token = None

while True:
page = bigquery.jobs().getQueryResults(
pageToken=page_token,
**query_job['jobReference']).execute(num_retries=2)

print(json.dumps(page['rows']))
results.extend(page.get('rows', []))

page_token = page.get('pageToken')
if not page_token:
break

print(json.dumps(results))
# [END paging]
# [END run]

Expand Down