You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ebaf7e4
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Set the BigQuery query location and a Cloud KMS encryption key (#1728) (#1757)
* Set the BigQuery query location and a Cloud KMS encryption key (#1728)
Adds DATACONTRACT_BIGQUERY_LOCATION / DATACONTRACT_BIGQUERY_KMS_KEY_NAME and the
server customProperties location / kmsKeyName, so datacontract test works on
projects that enforce customer-managed encryption keys.
* Name the error a mismatched BigQuery location causes in the docs
* Drop a docstring line that restates the patch
---------
Co-authored-by: bassem.benyahia <bassem.benyahia@aureskonnect.com>
Co-authored-by: Jakob Schödl <jakob.schoedl@entropy-data.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
10
10
### Added
11
11
-`datacontract test` loads the custom quality checks a contract uses from Entropy Data when an Entropy Data API key is set, unless the local folder has them
12
12
-`datacontract export sql`: export a schema with `physicalType: view` as a view (#1031)
13
+
-`datacontract test`: set the BigQuery query location and a Cloud KMS encryption key (CMEK) via `DATACONTRACT_BIGQUERY_LOCATION` / `DATACONTRACT_BIGQUERY_KMS_KEY_NAME` or the server `customProperties``location` / `kmsKeyName` (#1728)
13
14
14
15
### Changed
15
16
-`datacontract test` matches custom quality check IDs regardless of case
Copy file name to clipboardExpand all lines: docs/docs/reference/bigquery.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,37 @@ Authentication uses a Service Account Key or Application Default Credentials (AD
31
31
32
32
`project`and `dataset` come from the contract's `servers` block, and can be overridden with `DATACONTRACT_BIGQUERY_PROJECT` and `DATACONTRACT_BIGQUERY_DATASET`. `datacontract import bigquery` always uses ADC — set `GOOGLE_APPLICATION_CREDENTIALS` to point it at a key file.
33
33
34
+
### Query location and encryption key
35
+
36
+
By default, query jobs run in the location BigQuery chooses (`US` when none can be inferred) and carry no encryption key. Projects that enforce the org policy `constraints/gcp.restrictNonCmekServices` reject such jobs:
37
+
38
+
```
39
+
Your administrator requires that you specify an encryption key for queries in project `my-project`.
40
+
```
41
+
42
+
Set the query location and a Cloud KMS key with these variables, or as `customProperties` on the server so each environment can declare its own:
43
+
44
+
| Variable | Server `customProperties`| Example | Description |
45
+
|---|---|---|---|
46
+
|`DATACONTRACT_BIGQUERY_LOCATION`|`location`|`europe-west3`| Optional. Location in which query jobs run. Must match the location of the datasets. |
47
+
|`DATACONTRACT_BIGQUERY_KMS_KEY_NAME`|`kmsKeyName`|`projects/my-kms-project/locations/europe-west3/keyRings/my-ring/cryptoKeys/my-key`| Optional. Cloud KMS key that encrypts the query results. The caller's service account needs `roles/cloudkms.cryptoKeyEncrypterDecrypter` on the key. |
48
+
49
+
The variable wins over the custom property.
50
+
A location that doesn't match the datasets' fails with `403 Access Denied: … User does not have permission to query table …, or perhaps it does not exist`.
0 commit comments