【问题标题】:How to Set Big Query Require Partition Filter in BQ Commandline如何在 BQ 命令行中设置 Bigquery 需要分区过滤器
【发布时间】:2018-03-14 19:36:57
【问题描述】:

在 Big Query Web GUI 中创建新的空分区表架构时,您可以设置 Require Partition filter 选项。

如何在使用 bq 命令行工具创建表时设置相同的选项。现在我的命令是:

bq mk --table --time_partitioning_field event_time my_dataset.events event_id:INTEGER,event_time:TIMESTAMP

该命令成功创建了分区表,但我没有看到设置 Require Partition 过滤器的标志。

创建表格后如何编辑选项?

【问题讨论】:

    标签: google-bigquery


    【解决方案1】:

    回答你的第二个问题:

    bq update --require_partition_filter --time_partitioning_field=event_time my_dataset.events
    

    或者使用完全限定的表名:

    bq update --require_partition_filter --time_partitioning_field=event_time project-id:my_dataset.events
    

    您也可以通过以下方式禁用:

    bq update --norequire_partition_filter --time_partitioning_field=event_time project-id:my_dataset.events
    

    【讨论】:

      【解决方案2】:

      如果您使用的是 bq 命令行版本 >= 2.0.30,您应该会在 mk 命令中看到 --require_partition_filter 选项。如果不是这种情况,请告诉我们。谢谢!

      【讨论】:

      • 很高兴看到你回来 SO :o) ;您的回答(及时)对我非常有帮助
      • 谢谢@Pavan Edara。我更新了我的 bq 并获得了选项。
      • 有没有办法为已经创建和分区的表添加 --require_partition_filter 选项?
      • 您应该可以通过调用 Tables.update 来更新表的 require_partition_filter 属性
      猜你喜欢
      • 1970-01-01
      • 2021-11-25
      • 2017-02-18
      • 1970-01-01
      • 2014-08-03
      • 2019-02-15
      • 1970-01-01
      • 2023-03-19
      • 1970-01-01
      相关资源
      最近更新 更多