DataMaskingPolicy(mapping=None, *, ignore_unknown_fields=False, **kwargs)
The policy used to specify data masking rule.
This message has oneof
_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes |
|
---|---|
Name | Description |
predefined_expression |
google.cloud.bigquery_datapolicies_v2.types.DataMaskingPolicy.PredefinedExpression
Optional. A predefined masking expression. This field is a member of oneof _ masking_expression .
|
routine |
str
Optional. The name of the BigQuery routine that contains the custom masking routine, in the format of projects/{project_number}/datasets/{dataset_id}/routines/{routine_id} .
This field is a member of oneof _ masking_expression .
|
Classes
PredefinedExpression
PredefinedExpression(value)
The available masking rules. Learn more here: https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options.
- STRING: ""
- BYTES: b''
- INTEGER: 0
- FLOAT: 0.0
- NUMERIC: 0
- BOOLEAN: FALSE
- TIMESTAMP: 1970-01-01 00:00:00 UTC
- DATE: 1970-01-01
- TIME: 00:00:00
- DATETIME: 1970-01-01T00:00:00
- GEOGRAPHY: POINT(0 0)
- BIGNUMERIC: 0
- ARRAY: []
- STRUCT: NOT_APPLICABLE
- JSON: NULL
LAST_FOUR_CHARACTERS (4):
Masking expression shows the last four characters of text.
The masking behavior is as follows:
- If text length > 4 characters: Replace text with XXXXX,
append last four characters of original text.
- If text length <= 4 characters: Apply SHA-256 hash.
FIRST_FOUR_CHARACTERS (5):
Masking expression shows the first four characters of text.
The masking behavior is as follows:
- If text length > 4 characters: Replace text with XXXXX,
prepend first four characters of original text.
- If text length <= 4 characters: Apply SHA-256 hash.
EMAIL_MASK (6):
Masking expression for email addresses. The masking behavior
is as follows:
- Syntax-valid email address: Replace username with XXXXX.
For example, cloudysanfrancisco@gmail.com becomes
XXXXX@gmail.com.
- Syntax-invalid email address: Apply SHA-256 hash.
For more information, see `Email
mask <https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options>`__.
DATE_YEAR_MASK (7):
Masking expression to only show the year of `Date`,
`DateTime` and `TimeStamp`. For example, with the year
2076:
- DATE : 2076-01-01
- DATETIME : 2076-01-01T00:00:00
- TIMESTAMP : 2076-01-01 00:00:00 UTC
Truncation occurs according to the UTC time zone. To change
this, adjust the default time zone using the `time_zone`
system variable. For more information, see `System variables
reference <https://cloud.google.com/bigquery/docs/reference/system-variables>`__.
RANDOM_HASH (8):
Masking expression that uses hashing to mask
column data. It differs from SHA256 in that a
unique random value is generated for each query
and is added to the hash input, resulting in the
hash / masked result to be different for each
query. Hence the name "random hash".