Skip to content

Commit cc071bf

Browse files
bq table - add geojson support (#10215) (#17663)
* bq table - add geojson support * bq table - add geojson support * CR comments [upstream:6c2de90ffeeb029b6c3a49bfdf52540e010b155c] Signed-off-by: Modular Magician <[email protected]>
1 parent f6492a8 commit cc071bf

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

.changelog/10215.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
bigquery_table - add support for `external_data_configuration.json_extension`
3+
```

google/services/bigquery/resource_bigquery_table.go

+15
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,13 @@ func ResourceBigQueryTable() *schema.Resource {
624624
},
625625
},
626626

627+
"json_extension": {
628+
Type: schema.TypeString,
629+
Optional: true,
630+
ValidateFunc: validation.StringInSlice([]string{"GEOJSON"}, false),
631+
Description: `Load option to be used together with sourceFormat newline-delimited JSON to indicate that a variant of JSON is being loaded. To load newline-delimited GeoJSON, specify GEOJSON (and sourceFormat must be set to NEWLINE_DELIMITED_JSON).`,
632+
},
633+
627634
"parquet_options": {
628635
Type: schema.TypeList,
629636
Optional: true,
@@ -1786,6 +1793,10 @@ func expandExternalDataConfiguration(cfg interface{}) (*bigquery.ExternalDataCon
17861793
edc.Compression = v.(string)
17871794
}
17881795

1796+
if v, ok := raw["json_extension"]; ok {
1797+
edc.JsonExtension = v.(string)
1798+
}
1799+
17891800
if v, ok := raw["csv_options"]; ok {
17901801
edc.CsvOptions = expandCsvOptions(v)
17911802
}
@@ -1853,6 +1864,10 @@ func flattenExternalDataConfiguration(edc *bigquery.ExternalDataConfiguration) (
18531864
result["compression"] = edc.Compression
18541865
}
18551866

1867+
if edc.JsonExtension != "" {
1868+
result["json_extension"] = edc.JsonExtension
1869+
}
1870+
18561871
if edc.CsvOptions != nil {
18571872
result["csv_options"] = flattenCsvOptions(edc.CsvOptions)
18581873
}

google/services/bigquery/resource_bigquery_table_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -2955,6 +2955,8 @@ resource "google_bigquery_table" "test" {
29552955
encoding = "%s"
29562956
}
29572957
2958+
json_extension = "GEOJSON"
2959+
29582960
hive_partitioning_options {
29592961
mode = "CUSTOM"
29602962
source_uri_prefix = "gs://${google_storage_bucket.test.name}/{key1:STRING}"

website/docs/r/bigquery_table.html.markdown

+2
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ in Terraform state, a `terraform destroy` or `terraform apply` that would delete
190190
* `json_options` (Optional) - Additional properties to set if
191191
`source_format` is set to "JSON". Structure is [documented below](#nested_json_options).
192192

193+
* `json_extension` (Optional) - Used to indicate that a JSON variant, rather than normal JSON, is being used as the sourceFormat. This should only be used in combination with the `JSON` source format. Valid values are: `GEOJSON`.
194+
193195
* `parquet_options` (Optional) - Additional properties to set if
194196
`source_format` is set to "PARQUET". Structure is [documented below](#nested_parquet_options).
195197

0 commit comments

Comments
 (0)