php代码

php sdk

google-cloud-php-bigquery

分页的查询方式

全表

<?php

require 'vendor/autoload.php';

use Google\Cloud\BigQuery\BigQueryClient;

$bigQuery = new BigQueryClient(['keyFilePath' => './keybig.json']);

$maxResults = 1000;
$startIndex = 0;

$options = [
    'maxResults' => $maxResults,
    'startIndex' => $startIndex
];
$dataset = $bigQuery->dataset('austin_311');
$table = $dataset->table('311_request');
$numRows = 0;
foreach ($table->rows($options) as $row) {
     print('---');
    foreach ($row as $column => $value) {
        printf('%s: %s' . PHP_EOL, $column, $value);
    }
    $numRows++;
} 

根据query分页

Last updated

Was this helpful?