我有这个代码用于导出表格:
$job = new Google_Service_Bigquery_Job();
$config = new Google_Service_Bigquery_JobConfiguration();
$config->setDryRun(true);
$extractConfig = new Google_Service_Bigquery_JobConfigurationExtract();
$sourceTable = new Google_Service_Bigquery_TableReference;
$sourceTable->setDatasetId(DATASET_ID);
$sourceTable->setProjectId('aerobic-forge-504');
$sourceTable->setTableId('carmen_table1');
$extractConfig->setSourceTable($sourceTable);
$extractConfig->setDestinationFormat('CSV');
$dataFile = "gs://{my_bucket_edited}/reports_stage1.csv";
$extractConfig->setDestinationUri($dataFile);
$config->setExtract($extractConfig);
$job->setConfiguration($config);
try {
$job = $bq->jobs->insert(PROJECT_ID, $job);
$status = new Google_Service_Bigquery_JobStatus();
$status = $job->getStatus();
if ($status->count() != 0) {
$err_res = $status->getErrorResult();
die($err_res->getMessage());
}
} catch (Google_Service_Exception $e) {
print_r($e->getErrors());// HERE I GET THE ERROR
echo $e->getMessage();
exit;
}
当我运行时,我收到此错误:
调用POST时出错 https://www.googleapis.com/bigquery/v2/projects/aerobic-forge-504/jobs: (501)未实施:未实施
Array
(
[domain] => global
[reason] => notImplemented
[message] => Not Implemented: Not implemented
)
答案 0 :(得分:1)
我认为问题在于您尝试执行dryRun
提取作业,但未实施。尝试将dryRun设置为false。