如何从 Google App 脚本执行 Big Query table 的简单查询

How to execute simple query of Big Query table from Google App Script

我无法弄清楚如何从应用程序脚本函数针对大查询 Table 执行简单的删除查询。从 Big Query 控制台执行时查询有效。 错误返回为:无法识别的名称:对于我尝试传递给字符串查询的时间戳值。

BigQuery api 已加载到应用程序脚本中,因为我可以执行不带参数的简单 select 查询。

function RemoveRoles()
{
   var sheet = SpreadsheetApp.getActive().getSheetByName("Config");
   var value = sheet.getRange(2,2).getValue();

  const projectId = 'xxxxx-346316';

  const request = {
       
    query: 'delete FROM `xxxxx-346316.Feedback.Role`  where `Time` < `' + value + '`;', 
    useLegacySql: false
  };
  let queryResults = BigQuery.Jobs.query(request, projectId);
  const jobId = queryResults.jobReference.jobId;

  // Check on status of the Query Job.
  let sleepTimeMs = 500;
  while (!queryResults.jobComplete) {
    Utilities.sleep(sleepTimeMs);
    sleepTimeMs *= 2;
    queryResults = BigQuery.Jobs.getQueryResults(projectId, jobId);



}
}

GoogleJsonResponseException:API 调用 bigquery.jobs.query 失败,出现错误:无法识别的名称:2022-03-04 18:28:00 在 [1:58]

替换

  const request = {
       
    query: 'delete FROM `xxxxx-346316.Feedback.Role`  where `Time` < `' + value + '`;', 
    useLegacySql: false
  };    

  const request = {
       
    query: 'delete FROM `xxxxx-346316.Feedback.Role`  where `Time` < "' + value + '";', 
    useLegacySql: false
  };