custom_classifier!ADD_REGEX

See also:

Working with custom classifiers

Adds categories and a regular expression to the custom classifier, while optionally specifying a regular expression for the column name and a comment.

Syntax

CALL <custom_classifier>!ADD_REGEX(
  '<semantic_category>' ,
  '<privacy_category>' ,
  '<value_regex>' ,
  [ <column_name_regex> ] ,
  [ <description> ]
  )
Copy

Required arguments

semantic_category

Specifies the identifier (i.e. name) for semantic category.

For details about semantic categories, see System tags and categories.

privacy_category

Specify one of the following values: 'IDENTIFIER', 'QUASI_IDENTIFIER', or 'SENSITIVE'.

For details about privacy categories, see System tags and categories.

value_regex

Specifies the regular expression to match the values in a column.

You can test the syntax of the regular expression by calling the REGEXP_LIKE function.

Optional arguments

column_name_regex

Specifies the regular expression to match the name of the column that you want to classify.

description

Specifies a comment for the values that you add to the instance.

Output

Returns a status message indicating the association of the category with the custom classifier in this format: classifier_name:category_name.

Access control requirements

A role used to execute this SQL command must have the following privileges at a minimum:

Instance role

Object

Notes

custom_classifier!PRIVACY_USER.

The custom classification instance.

The account role that calls this method must be granted this instance role on the custom classifier.

By default, the account role used to create the instance can call this method.

Note that operating on any object in a schema also requires the USAGE privilege on the parent database and 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.

Usage notes

  • Calling this method multiple times gives an additive result for the number of regular expressions associated with the instance.

  • Call each method in a separate SQL statement (no method chaining).

  • 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:

    SELECT <col_to_classify>
    FROM <table_with_col_to_classify>
    WHERE <col_to_classify> REGEXP('<regex>');
    
    Copy

    For details, see String Functions (Regular Expressions).

Examples

For a representative example, see the custom classification example.