【发布时间】:2021-12-02 17:26:00
【问题描述】:
我在 BigQuery 上更改了一些配置,实际上我无法再获取数据了。
这是流程:
$query = "select what i need to select";
$client = new Google_Client();
$client->setApplicationName('Google-BigQuery');
$client->useApplicationDefaultCredentials(); // running in app engine env
$client->addScope('https://www.googleapis.com/auth/bigquery');
$client->addScope('https://www.googleapis.com/auth/devstorage.read_write');
$bq = new Google_Service_Bigquery($client);
$job = new Google_Service_Bigquery_Job();
$config = new Google_Service_Bigquery_JobConfiguration();
$queryConfig = new Google_Service_Bigquery_JobConfigurationQuery();
$config->setQuery($queryConfig);
$job->setConfiguration($config);
$queryConfig->setQuery($query);
然后:
$job = $bq->jobs->insert($project, $job); // OK
$jr = $job->getJobReference(); // OK -> here i got jobid as $jr['jobId']
$queryResults = $bq->jobs->getQueryResults('my-project', 'job-id-from-jr'); // ERROR
如果我从 BigQuery 信息中心运行查询,它就可以工作并且我可以获得结果。 在这里我得到一个 404 错误,“未找到”,我检查了作业 ID 是否与仪表板上的匹配,并且匹配。 { "error": { "code": 404, "message": "Not found: Job my-project:job-id",
唯一的区别是在仪表板内的作业中将位置指定为
我的名字:europe-west1.job-id
找不到直接指定执行区域的方法,我尝试将 europe-west1 作为字符串添加到 job-id 之前,但出现错误(无法完成)。
有办法解决这个问题吗?可以指定区域吗?
谢谢!
【问题讨论】:
标签: php google-bigquery