The CREATE MASK RULE
syntax is used to create a mask rule.
CreateEncryptRule ::=
'CREATE' 'MASK' 'RULE' ifNotExists? maskRuleDefinition (',' maskRuleDefinition)*
ifNotExists ::=
'IF' 'NOT' 'EXISTS'
maskRuleDefinition ::=
ruleName '(' 'COLUMNS' '(' columnDefinition (',' columnDefinition)* ')' ')'
columnDefinition ::=
'(' 'NAME' '=' columnName ',' maskAlgorithmDefinition ')'
maskAlgorithmDefinition ::=
'TYPE' '(' 'NAME' '=' maskAlgorithmType (',' propertiesDefinition)? ')'
propertiesDefinition ::=
'PROPERTIES' '(' key '=' value (',' key '=' value)* ')'
ruleName ::=
identifier
columnName ::=
identifier
maskAlgorithmType ::=
literal
key ::=
string
value ::=
literal
maskAlgorithmType
specifies the data masking algorithm type. For more details, please refer to Data Masking Algorithm;ruleName
will not be created;ifNotExists
clause is used for avoid Duplicate mask rule
error.CREATE MASK RULE t_mask (
COLUMNS(
(NAME=phone_number,TYPE(NAME='MASK_FROM_X_TO_Y', PROPERTIES("from-x"=1, "to-y"=2, "replace-char"="*"))),
(NAME=address,TYPE(NAME='MD5'))
));
ifNotExists
clauseCREATE MASK RULE IF NOT EXISTS t_mask (
COLUMNS(
(NAME=phone_number,TYPE(NAME='MASK_FROM_X_TO_Y', PROPERTIES("from-x"=1, "to-y"=2, "replace-char"="*"))),
(NAME=address,TYPE(NAME='MD5'))
));
CREATE
, MASK
, RULE
, COLUMNS
, NAME
, TYPE