【问题标题】:Creating a table from a query result in bigquery using node.js使用 node.js 从 bigquery 中的查询结果创建表
【发布时间】:2019-03-18 21:16:31
【问题描述】:

我想按照这里的描述做:

https://cloud.google.com/bigquery/docs/tables#creating_a_table_from_a_query_result

但是,我正在使用没有文档的 node.js 客户端库。这可能不受 node.js 客户端库的支持,或者可能尚未为 node.js 记录。

===替代解决方案===

@ElliottBrossard 建议的替代解决方案是使用此处记录的 create table 语句:

https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_statement

如下

bigQuery.query({
  query: 'CREATE OR REPLACE TABLE `<project_name>.<dataset_name>.<output_table_name>` AS SELECT * FROM `<project_name>.<dataset_name>.<input_table_name>*`',
  useLegacySql: false, // Use standard SQL syntax for queries.
})

【问题讨论】:

标签: google-bigquery


【解决方案1】:

除了问题中提供的解决方案之外,还有对将查询结果写入表的原生支持。 BigQuery.createQueryjob 会将结果写入新表。表的名称在选项对象的destination 属性中指定。

example 作为文档的一部分在线。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-11-11
    • 2013-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多