Skip to content

Commit 3b6d742

Browse files
committed
impl(google_bigquery_table): exposing 'TableMetadataView' query param as 'table_metadata_view'
1 parent fed2c98 commit 3b6d742

File tree

3 files changed

+95
-72
lines changed

3 files changed

+95
-72
lines changed

mmv1/products/bigquery/Table.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -645,3 +645,11 @@ properties:
645645
from BigQuery Engine. The connection_id can have the form `<project_id>.<location_id>.<connection_id>`
646646
or `projects/<project_id>/locations/<location_id>/connections/<connection_id>`.
647647
min_version: beta
648+
virtual_fields:
649+
- name: 'table_metadata_view'
650+
type: String
651+
description: |
652+
View sets the optional parameter "view": Specifies the view that determines which table information is
653+
returned. By default, basic table information and storage statistics (STORAGE_STATS) are returned.
654+
Possible values: TABLE_METADATA_VIEW_UNSPECIFIED, BASIC, STORAGE_STATS, FULL
655+
default_value: "TABLE_METADATA_VIEW_UNSPECIFIED"

mmv1/third_party/terraform/services/bigquery/resource_bigquery_table.go.tmpl

+14-1
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,12 @@ func ResourceBigQueryTable() *schema.Resource {
14471447
},
14481448
},
14491449
},
1450+
"table_metadata_view": {
1451+
Type: schema.TypeString,
1452+
Optional: true,
1453+
Default: "TABLE_METADATA_VIEW_UNSPECIFIED",
1454+
Description: `View sets the optional parameter "view": Specifies the view that determines which table information is returned. By default, basic table information and storage statistics (STORAGE_STATS) are returned. Possible values: TABLE_METADATA_VIEW_UNSPECIFIED, BASIC, STORAGE_STATS, FULL`,
1455+
},
14501456
// TableReplicationInfo: [Optional] Replication info of a table created using `AS REPLICA` DDL like: `CREATE MATERIALIZED VIEW mv1 AS REPLICA OF src_mv`.
14511457
"table_replication_info": {
14521458
Type: schema.TypeList,
@@ -1834,7 +1840,14 @@ func resourceBigQueryTableRead(d *schema.ResourceData, meta interface{}) error {
18341840
datasetID := d.Get("dataset_id").(string)
18351841
tableID := d.Get("table_id").(string)
18361842

1837-
res, err := config.NewBigQueryClient(userAgent).Tables.Get(project, datasetID, tableID).Do()
1843+
tableMetadataView := d.Get("table_metadata_view").(string)
1844+
1845+
client := config.NewBigQueryClient(userAgent).Tables.Get(project, datasetID, tableID)
1846+
if len(tableMetadataView) > 0 {
1847+
client = client.View(tableMetadataView)
1848+
}
1849+
res, err := client.Do()
1850+
18381851
if err != nil {
18391852
return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("BigQuery table %q", tableID))
18401853
}

0 commit comments

Comments
 (0)