<code className=”samp”><em>custom_ classifier</em></code>!ADD_ REGEX¶
为自定义分类器添加类和正则表达式,同时可为列名指定正则表达式和注释。
语法
实参
必填:
SEMANTIC_CATEGORY => custom_categorySpecifies the name of the custom category (that is, type of information).
PRIVACY_CATEGORY => { 'IDENTIFIER' | 'QUASI-IDENTIFIER' | 'SENSITIVE' }Specifies the sensitivity of the data, and can be one of the following values:
'IDENTIFIER','QUASI_IDENTIFIER', or'SENSITIVE'.VALUE_REGEX => regular_expression指定正则表达式以匹配列中的值。
You can test the syntax of the regular expression by calling the REGEXP_LIKE function.
可选:
COL_NAME_REGEX => regular_expression指定与要分类的列名匹配的正则表达式。
DESCRIPTION => stringSpecifies a comment describing the custom category or the custom classifier that implements it.
THRESHOLD => numberSpecifies the threshold value for the scoring rule. For more information, see Threshold for custom categories.
The acceptable range is greater than
0.0and less than or equal to1.0.Default:
0.8.
输出
Returns a status message indicating the association of the category with the custom classifier in this format:
classifier_name:category_name.
访问控制要求
A role used to execute this operation must have the following privileges at a minimum:
| Instance role | Object | Notes |
|---|---|---|
custom_classifier!PRIVACY_USER | The custom classification instance. | 调用此方法的账户角色必须在自定义分类器上被授予此实例角色。 默认情况下,用于创建实例的账户角色可以调用此方法。 |
Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent schema.
For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.
For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.
使用说明
-
多次调用此方法会得到与该实例相关的正则表达式数量的累加结果。
-
在单独的 SQL 语句中调用每个方法(无需方法链接)。
-
所有用于分类目的的正则表达式搜索都不区分大小写。
-
Test the regular expression before adding a regular expression to the custom classification instance. For example, use the [ NOT ] REGEXP function to make sure that only values that match the regex are returned in the result:
For details, see String functions (regular expressions).
示例
Add categories and a regular expression to the medical_codes instance:
Returns:
Create a custom classifier that uses the default threshold and doesn’t use a regular expression to match column names: