【问题标题】:BigQuery NodeJS: Delete Rows/DML SupportBigQuery NodeJS:删除行/DML 支持
【发布时间】:2020-10-12 23:49:14
【问题描述】:

有没有办法使用 BigQuery 的 NodeJS 库 (https://github.com/googleapis/nodejs-bigquery) 来删除行?在文档中找不到任何内容 (https://googleapis.dev/nodejs/bigquery/latest/index.html)

看来应该可以通过 DML (https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#delete_examples) 使用 DELETE 语句,但我找不到任何关于如何通过 NodeJS 库运行此示例的示例。

【问题讨论】:

    标签: node.js google-cloud-platform google-bigquery


    【解决方案1】:

    如果您知道如何在 BigQuery 中执行 SELECT 查询,那么您也可以执行 DELETE 查询。

        const query = `SELECT name
          FROM \`bigquery-public-data.usa_names.usa_1910_2013\`
          WHERE state = 'TX'
          LIMIT 100`;
    
        // For all options, see https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query
        const options = {
          query: query,
          // Location must match that of the dataset(s) referenced in the query.
          location: 'US',
        };
    
        // Run the query as a job
        const [job] = await bigquery.createQueryJob(options);
    

    只需将该示例中的query 更改为DELETE FROM ____ WHERE ____

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-08-16
      • 2016-12-19
      • 1970-01-01
      • 2020-08-15
      • 2012-05-23
      • 2010-11-06
      • 1970-01-01
      相关资源
      最近更新 更多