小编Ase*_*ake的帖子

如何修复错误“对 bigquery.jobs.query 的 API 调用失败并出现错误:遇到““FROM”“来自“”在 .... 期待:“)”'

我正在尝试使用来自 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: ")" ... …

google-apps-script google-bigquery google-sheets-api

4
推荐指数
1
解决办法
2909
查看次数