Database Reference
In-Depth Information
results. Other times, however, you really do want to see all the resources
in the collection. The mechanism to access other pages of results is called
paging . BigQuery, like other Google APIs, supports paging primarily via the
maxResults and pageToken arguments. It also has limited support for
index-based pagination. These flags are described next.
maxResults
The first tool that you can use for paging is the maxResults parameter,
which controls the maximum number of results that can be returned. This
flag is accepted on all BigQuery collections. Let's create a new scratch
dataset so we have more than one to list:
$ bq --project_id=${PROJECT_ID} \
mk -d "scratch_2"
Now, to list datasets in the your project but limit the results to the first one,
you can run the following curl command:
$ curl -H "$(python auth.py)" \
"${DATASETS_URL}?maxResults=1" \
{
"datasets": [
{
"kind": "bigquery#dataset",
"id": "bigquery-e2e:scratch",
"datasetReference": {
"datasetId": "scratch",
"projectId": "bigquery-e2e"
}
}
]
}
If the number you give is larger than the largest accepted by BigQuery, you
get BigQuery's maximum rather than an error. This makes it easier to say
“give me as many results as possible.”
Search WWH ::




Custom Search