Skip to main content

data_policies

Creates, updates, deletes, gets or lists a data_policies resource.

Overview

Namedata_policies
TypeResource
Idgoogle.bigquerydatapolicy.data_policies

Fields

NameDatatypeDescription
namestringOutput only. Resource name of this data policy, in the format of projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}.
dataMaskingPolicyobjectThe data masking policy that is used to specify data masking rule.
dataPolicyIdstringUser-assigned (human readable) ID of the data policy that needs to be unique within a project. Used as {data_policy_id} in part of the resource name.
dataPolicyTypestringType of data policy.
policyTagstringPolicy tag resource name, in the format of projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id}.

Methods

NameAccessible byRequired ParamsDescription
getSELECTdataPoliciesId, locationsId, projectsIdGets the data policy specified by its resource name.
listSELECTlocationsId, projectsIdList all of the data policies in the specified parent project.
createINSERTlocationsId, projectsIdCreates a new data policy under a project with the given dataPolicyId (used as the display name), policy tag, and data policy type.
deleteDELETEdataPoliciesId, locationsId, projectsIdDeletes the data policy specified by its resource name.
patchUPDATEdataPoliciesId, locationsId, projectsIdUpdates the metadata for an existing data policy. The target data policy can be specified by the resource name.
renameEXECdataPoliciesId, locationsId, projectsIdRenames the id (display name) of the specified data policy.

SELECT examples

List all of the data policies in the specified parent project.

SELECT
name,
dataMaskingPolicy,
dataPolicyId,
dataPolicyType,
policyTag
FROM google.bigquerydatapolicy.data_policies
WHERE locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

INSERT example

Use the following StackQL query and manifest file to create a new data_policies resource.

/*+ create */
INSERT INTO google.bigquerydatapolicy.data_policies (
locationsId,
projectsId,
policyTag,
dataMaskingPolicy,
dataPolicyType,
dataPolicyId
)
SELECT
'{{ locationsId }}',
'{{ projectsId }}',
'{{ policyTag }}',
'{{ dataMaskingPolicy }}',
'{{ dataPolicyType }}',
'{{ dataPolicyId }}'
;

UPDATE example

Updates a data_policies resource.

/*+ update */
UPDATE google.bigquerydatapolicy.data_policies
SET
policyTag = '{{ policyTag }}',
dataMaskingPolicy = '{{ dataMaskingPolicy }}',
dataPolicyType = '{{ dataPolicyType }}',
dataPolicyId = '{{ dataPolicyId }}'
WHERE
dataPoliciesId = '{{ dataPoliciesId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

DELETE example

Deletes the specified data_policies resource.

/*+ delete */
DELETE FROM google.bigquerydatapolicy.data_policies
WHERE dataPoliciesId = '{{ dataPoliciesId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';