我正在尝试使用来自 appscript 的查询字符串(附在代码中)运行 bigquery api 调用;查询在 bigquery UI 中运行良好
我尝试了以下但没有成功:
1. 在查询字符串中的 orders.creation_date 中包含括号
2. 用实际表替换订单,即 [my-project:theservices.theservice_order_item]
/**
* Runs a BigQuery query and logs the results in a spreadsheet.
*/
function runQuery() {
var projectId = 'my-project';
var request = {
query:
"SELECT extract(date from orders.creation_date) as the_date \n FROM [my-project:theservices.theservice_order_item] AS orders LIMIT 10;"
};
};
Run Code Online (Sandbox Code Playgroud)
以下是我得到的错误:
API call to bigquery.jobs.query failed with error: Encountered " "FROM" "from "" at line 1, column 22. was expected: ")" ... …