hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.29k stars 1.72k forks source link

Support for non-incremental materialized views in BQ #15317

Open kevin-meyers opened 1 year ago

kevin-meyers commented 1 year ago

Community Note

Description

Non-incremental is a materialized view option available via api or directly in the OPTIONS clause of sql. It enables materialized view support for many more situations, including our current need for a left join: https://cloud.google.com/bigquery/docs/materialized-views-create#non-incremental

From my cursory search, it looks like this could be as simple as adding the flag and a few lines to expandMaterializedView and flattenMaterializedView.

New or Affected Resource(s)

Potential Terraform Configuration

-- copied option values from example listed at link above
resource "google_bigquery_table" "test" {
  dataset_id          = google_bigquery_dataset.test.dataset_id
  table_id            = "test"
  materialized_view {
    query = "SELECT ..."
    refresh_interval_ms = "3600000"
    enable_refresh = true
    -- NEW BELOW
    allow_non_incremental_definition = true
    max_staleness = "INTERVAL '4' HOUR"
  }
}
sachinpro commented 1 year ago

This should be fixed by the #8725.