Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Set Big Query Require Partition Filter in BQ Commandline

When Creating a new empty partitioned table schema in Big Query Web GUI, you can SET the Require Partition filter Option.

How can I set the same option when creating a table using bq command-line tool. Right now my command is:

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

The command successfully creates the Partitioned Table, but I have not seen a flag for setting the Require Partition filter.

How can I edit the Option later after creating the table?

like image 408
osmumos Avatar asked Mar 14 '18 19:03

osmumos


2 Answers

To answer your second question:

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

Or with a fully qualified table name:

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

You can also disable with:

bq update --norequire_partition_filter --time_partitioning_field=event_time project-id:my_dataset.events
like image 179
kennethmac2000 Avatar answered Sep 28 '22 00:09

kennethmac2000


If you are using a bq command line version >= 2.0.30 you should see a --require_partition_filter option in the mk command. Please let us know if this is not the case. Thanks!

like image 26
Pavan Edara Avatar answered Sep 27 '22 22:09

Pavan Edara