Ben
Ben

Reputation: 1901

Paginate through BigQuery query results using python

I see that the BigQuery REST API allows for pagination through results, and I see that the BigQuery python client allows pagination when listing rows in a table (among other things), but I do not see a way to paginate through query results.

The Job makes a call to client.list_rows, but does not give the caller the option of passing in max_results:

https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/bigquery/google/cloud/bigquery/job.py#L2404

It also does not expose sufficient information, as far as I can tell, to be able to build the Table definition (I don't see where to get the query schema) external to the Job and make the list_rows call myself.

Hopefully I'm just missing something...

Help would be greatly appreciated,

--Ben

Upvotes: 1

Views: 2438

Answers (1)

yiru
yiru

Reputation: 21

jobs.getQueryResults do support a page token: https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/getQueryResults

Upvotes: 0

Related Questions