1
我正在尋找一種方法來通過客戶端庫php在BIG查詢中覆蓋現有表格。BIQ QUERY /通過php覆蓋表格
在WEB UI中,我可以通過「Destination Table」和「 Write Preference」選項輕鬆完成此任務,可以在php中做同樣的事情嗎?
我正在尋找一種方法來通過客戶端庫php在BIG查詢中覆蓋現有表格。BIQ QUERY /通過php覆蓋表格
在WEB UI中,我可以通過「Destination Table」和「 Write Preference」選項輕鬆完成此任務,可以在php中做同樣的事情嗎?
composer.json
{
"require": {
"google/cloud": "^0.13.0",
"google/apiclient": "^2.0"
}
}
我有這段代碼覆蓋表
$builder = $this->getServiceBuilder();
$bigQuery = $builder->bigQuery();
// Get an instance of a previously created table.
$dataset = $bigQuery->dataset('wr_temp');
$table = $dataset->table('shop_api_order_id');
// Begin a job to import data from a CSV file into the table.
if (!is_file($data['params']['filename'])) {
$this->e('File ' . $data['params']['filename'] . ' cannot be located');
return false;
}
$job = $table->load(
fopen($data['params']['filename'], 'r'), array(
'jobConfig' => array(
"writeDisposition" => 'WRITE_TRUNCATE',
"schema" => array(
"fields" => array(array(
"name" => 'order_id',
"type" => 'INTEGER',
"mode" => 'NULLABLE',
)
)
)
)
)
);
$isComplete = $job->isComplete();
while (!$isComplete) {
sleep(1); // let's wait for a moment...
$job->reload();
$isComplete = $job->isComplete();
}
謝謝您的回答 的_ 'jobConfig' _正是我需要的 但你知道如何在php中查詢表格? –
@ pierre-emmanuel問一個新問題,有人會回答 – Pentium10