Reputation: 3301
https://googlecloudplatform.github.io/google-cloud-php/#/docs/v0.21.1/bigquery/table?method=rows
Bigquery table has method "rows". rows() method can take parameter "options", which can be used for pagination
Such as
$options = [
'maxResults' => 3,
'startIndex' => 0
];
$rows = $table->rows($options);
Now what I want is using pagination in bigquery queryresults rows() method
Here is the documentation for queryresults rows method. rows() also takes options as parameter. (But it does not give which field should be in the options).
$queryResults = $this->bigQuery->runQuery($query, ['useLegacySql' => false]);
$options = [
'maxResults' => 3,
'startIndex' => 0
];
$rows = $queryResults->rows($options);
But the options only ask for the top 3 records does not work. It still give me full set of queryresults rows.
Thanks!
Upvotes: 2
Views: 376
Reputation: 289
The maxResults option actually needs to be set on the runQuery call:
$queryResults = $this->bigQuery->runQuery($query, [
'useLegacySql' => false,
'maxResults' => 3
]);
Let me know if that does the trick for you.
Upvotes: 3