0
我跟着這個樣本數據導出到雲存儲 - PHP客戶端庫 - 有云存儲文件一個額外的空新行
https://cloud.google.com/bigquery/docs/exporting-data
public function exportDailyRecordsToCloudStorage($date, $tableId)
{
$validTableIds = ['table1', 'table2'];
if (!in_array($tableId, $validTableIds))
{
die("Wrong TableId");
}
$date = date("Ymd", date(strtotime($date)));
$datasetId = $date;
$dataset = $this->bigQuery->dataset($datasetId);
$table = $dataset->table($tableId);
// load the storage object
$storage = $this->storage;
$bucketName = 'mybucket';
$objectName = "daily_records/{$tableId}_" . $date;
$destinationObject = $storage->bucket($bucketName)->object($objectName);
// create the import job
$format = 'NEWLINE_DELIMITED_JSON';
$options = ['jobConfig' => ['destinationFormat' => $format]];
$job = $table->export($destinationObject, $options);
// poll the job until it is complete
$backoff = new ExponentialBackoff(10);
$backoff->execute(function() use ($job) {
print('Waiting for job to complete' . PHP_EOL);
$job->reload();
if (!$job->isComplete()) {
//throw new Exception('Job has not yet completed', 500);
}
});
// check if the job has errors
if (isset($job->info()['status']['errorResult'])) {
$error = $job->info()['status']['errorResult']['message'];
printf('Error running job: %s' . PHP_EOL, $error);
} else {
print('Data exported successfully' . PHP_EOL);
}
我在table1的37670行,雲存儲文件有37671行。
而我有388065我的表2,雲存儲文件有388066行。
這兩個雲存儲文件的最後一行都是空行。
這是Google BigQuery功能改進請求嗎?或者我在上面的代碼中做錯了什麼?
我來自bigquery,我爲此問題創建了一個勾號。但是在將來,您還可以使用[BigQuery問題跟蹤器](http://code.google.com/p/google-bigquery/)報告此類問題。 – xuejian