Skip to content

Commit

Permalink
Add support for range partitioning in BigQuery (#2890) (#5723)
Browse files Browse the repository at this point in the history
* Add support for range partitioning in BigQuery

Currently only time partitioning is supported.

* Remove the nested fields since they aren't necessary

* Fix compilation errors

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Feb 19, 2020
1 parent 9fd0c1f commit dd13564
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/2890.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
Support for range-based partitioning in BigQuery tables has landed. Fixes https://github.com/terraform-providers/terraform-provider-google/issues/5239.
```
2 changes: 1 addition & 1 deletion google/resource_bigquery_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ resource "google_bigquery_table" "test" {
time_partitioning {
type = "DAY"
field = "ts"
field = "ts"
}
encryption_configuration {
Expand Down
21 changes: 20 additions & 1 deletion website/docs/r/bigquery_table.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ The following arguments are supported:
* `time_partitioning` - (Optional) If specified, configures time-based
partitioning for this table. Structure is documented below.

* `range_partitioning` - (Optional, Beta) If specified, configures range-based
partitioning for this table. Structure is documented below.

* `clustering` - (Optional) Specifies column names to use for data clustering.
Up to four top-level columns are allowed, and should be specified in
descending priority order.
Expand Down Expand Up @@ -176,7 +179,7 @@ The `csv_options` block supports:
characters, you must also set the `allow_quoted_newlines` property to true.
The API-side default is `"`, specified in Terraform escaped as `\"`. Due to
limitations with Terraform default values, this value is required to be
explicitly set.
explicitly set.

* `allow_jagged_rows` (Optional) - Indicates if BigQuery should accept rows
that are missing trailing optional columns.
Expand Down Expand Up @@ -220,6 +223,22 @@ The `time_partitioning` block supports:
require a partition filter that can be used for partition elimination to be
specified.

The `range_partitioning` block supports:

* `field` - (Required) The field used to determine how to create a range-based
partition.

* `range` - (Required) Information required to partition based on ranges.
Structure is documented below.

The `range` block supports:

* `start` - (Required) Start of the range partitioning, inclusive.

* `end` - (Required) End of the range partitioning, exclusive.

* `interval` - (Required) The width of each range within the partition.

The `view` block supports:

* `query` - (Required) A query that BigQuery executes when the view is referenced.
Expand Down

0 comments on commit dd13564

Please sign in to comment.