[英]Define BigQuery table location in Google Apps Script
I am trying to read data form BigQuery table in Google Apps Script.我正在尝试从 Google Apps 脚本中的 BigQuery 表中读取数据。 Target table is located in EU region, but US is requested by default from script.
目标表位于欧盟区域,但脚本默认请求美国。
Code代码
var request = {
query: 'SELECT * FROM `table-name`'
};
var queryResults = BigQuery.Jobs.query(request, projectId);
Error:错误:
GoogleJsonResponseException: API call to bigquery.jobs.query failed with error: Not found: Dataset <dataset-name.table-name> was not found in location US
GoogleJsonResponseException:API 调用 bigquery.jobs.query 失败,出现错误:未找到:在美国位置未找到数据集 <dataset-name.table-name>
Quotes `` was a problem, table name should be without without quotes:引号``是个问题,表名应该没有引号:
var projectId = "project_id"
var request = {
query: 'SELECT * FROM data_set.table ',
};
var queryResults = BigQuery.Jobs.query(request, projectId);
Your query is expected to be automatically routed to where the data is, if you have the right dataset to qualify the table name, eg:如果您有合适的数据集来限定表名,您的查询应该会自动路由到数据所在的位置,例如:
SELECT * FROM `myDatasetInEu.table-name`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.