【问题标题】:Import CSV to partitioned table on BigQuery using specific timestamp column?使用特定时间戳列将 CSV 导入 BigQuery 上的分区表?
【发布时间】:2016-07-05 04:04:27
【问题描述】:

我想将一个大型 csv 导入到一个 bigquery 分区表中,该表的时间戳类型列实际上是某个事务的日期,问题是当我加载数据时,它会将所有内容都导入到今天日期的一个分区中。

是否可以使用我自己的时间戳值对其进行分区?我该怎么做。

【问题讨论】:

    标签: google-bigquery


    【解决方案1】:

    BigQuery 目前不支持基于特定列的分区。
    即使此列与日期相关(时间戳)。
    您要么依赖插入时间,以便 BigQuery 引擎将插入相应的分区,要么指定要将数据插入的确切分区
    查看更多关于Creating and Updating Date-Partitioned Tables

    【讨论】:

      【解决方案2】:

      目前最好的方法是使用 Google Dataflow [1]。您可以开发一个流式传输pipeline,它将从 Google Cloud Storage 存储桶中读取文件并将行插入 BigQuery 的表中。

      您需要在运行管道之前手动创建分区表 [2],因为 Dataflow 目前不支持创建分区表

      [3] 中提供了多个示例

      [1]https://cloud.google.com/dataflow/docs/

      [2]https://cloud.google.com/bigquery/docs/creating-partitioned-tables

      [3]https://cloud.google.com/dataflow/examples/all-examples

      【讨论】:

        猜你喜欢
        • 2020-01-13
        • 1970-01-01
        • 2019-06-29
        • 2014-05-07
        • 1970-01-01
        • 2017-06-01
        • 1970-01-01
        • 2020-02-07
        • 1970-01-01
        相关资源
        最近更新 更多