ASSOCIATE_SEMANTIC_CATEGORY_TAGS

Takes the results of the EXTRACT_SEMANTIC_CATEGORIES function on a table/view and applies the results as tags on the supported columns in the table/view.

Before calling this stored procedure, you should first execute the EXTRACT_SEMANTIC_CATEGORIES function on the table/view and determine whether you are satisfied with the results generated by the classification algorithm.

Syntax

ASSOCIATE_SEMANTIC_CATEGORY_TAGS( '<object_name>' , <category_extraction_result> )
Copy

Arguments

object_name

The name of the table, external table, view, or materialized view containing the columns to be classified. If a database and schema are not in use in the current session, the name must be fully-qualified.

The name must be specified exactly as it is stored in the database. If the name contains special characters, capitalization, or blank spaces, the name must be enclosed first in double-quotes and then in single quotes.

category_extraction_result

The result from executing the EXTRACT_SEMANTIC_CATEGORIES function on the same table/view.

Usage notes

Examples

Extract the semantic and privacy categories for the my_db.my_schema.hr_data table and apply the categories as tags for the table:

USE ROLE data_engineer;

CALL ASSOCIATE_SEMANTIC_CATEGORY_TAGS('mydb.my_schema.hr_data',
                                      EXTRACT_SEMANTIC_CATEGORIES('mydb.my_schema.hr_data'));
Copy

Apply the results from EXTRACT_SEMANTIC_CATEGORIES that have been stored in the classification_results table:

USE ROLE data_engineer;

CALL ASSOCIATE_SEMANTIC_CATEGORY_TAGS('mydb.my_schema.hr_data',
                                      (SELECT * FROM classification_results));
Copy

Modify the results from EXTRACT_SEMANTIC_CATEGORIES in the classification_results table and apply the tags:

USE ROLE data_engineer;

UPDATE classification_results SET V =
    OBJECT_INSERT(V,'LNAME',OBJECT_INSERT(
        OBJECT_INSERT(V:LNAME,'semantic_category','NAME',TRUE),
        'privacy_category','IDENTIFIER',TRUE),
        TRUE
        );

CALL ASSOCIATE_SEMANTIC_CATEGORY_TAGS('mydb.my_schema.hr_data',
                                      (SELECT * FROM classification_results));
Copy