CREATE CLASSIFICATION_PROFILE¶
完全限定名称 :SNOWFLAKE.DATA_PRIVACY.CLASSIFICATION_PROFILE
在当前或指定架构中创建 CLASSIFICATION_PROFILE 类的新实例或替换现有 CLASSIFICATION_PROFILE 类的实例。
重要
如果执行 CREATE OR REPLACE 命令,则分类配置文件将从所有数据库和架构中移除,从而关闭自动分类。
语法¶
CREATE [ OR REPLACE ] SNOWFLAKE.DATA_PRIVACY.CLASSIFICATION_PROFILE
[ IF NOT EXISTS ] <classification_profile_name> ( <config_object> )
参数¶
classification_profile_name指定 CLASSIFICATION_PROFILE 类实例的标识符(名称);在创建对象的架构中必须是唯一的。
此外,标识符必须以字母字符开头,且不能包含空格或特殊字符,除非整个标识符字符串放在双引号内(例如,
"My object")。放在双引号内的标识符也区分大小写。有关更多信息,请参阅 标识符要求。
构造函数实参¶
config_objectAn OBJECT containing key-value pairs used to configure sensitive data classification.
键
类型
默认值
描述
minimum_object_age_for_classification_daysINTEGER
必需:指定要进行分类的对象必须存在的最短天数。
要立即对对象进行分类,请指定
0。maximum_classification_validity_daysINTEGER
可选:指定自上次分类事件发生到再次使用自动分类对表进行分类的天数。
指定此值以确保对表进行重新分类。如果省略此键,则永远不会对对象进行重新分类。
该值必须大于或等于
1。snowflake_semantic_categoriesARRAY
Optional: Specifies a list of Snowflake native semantic categories (types of data) and optional countries to use for classification. Snowflake identifies data as sensitive only if the data is classified as belonging to the specified categories (and countries, if provided). The array can contain the following keys:
category--- Required string that specifies a native semantic category.country_codes--- Optional array that specifies two-letter country codes. Snowflake identifies data as belonging to a category only if a semantic subcategory exists for the specified country.To determine if a semantic subcategory exists for a country and obtain the two-letter code for a country, see native semantic categories.
See Classify data using a subset of native semantic categories.
auto_tagBOOLEAN
TRUE
可选:若为
TRUE,分类过程完成后,在指定对象的列上设置推荐的分类系统标签。若为
FALSE,自动标记不会发生。tag_mapOBJECT
可选:将一个或多个用户定义的标签映射到 SEMANTIC_CATEGORY 系统标签。
请参阅 标签映射。
custom_classifiersOBJECT
可选:指定自动分类数据时使用的 自定义分类器。
对象中的每个键都指定了 CUSTOM_CLASSIFIER 类 实例的名称。
每个键的值指定了自定义分类器实例的 custom_classifier!LIST 方法。
enable_tag_based_sensitive_data_exclusionBOOLEAN
FALSE
Optional: When
TRUE, objects tagged with the SNOWFLAKE.CORE.SKIP_SENSITIVE_DATA_CLASSIFICATION system tag are excluded from sensitive data classification.当
FALSE时,将禁用基于标签的敏感数据排除,并且无论系统标签如何,所有对象都会被分类。有关更多信息,请参阅 Excluding data from sensitive data classification。
classify_viewsBOOLEAN
FALSE
可选:当
FALSE时,视图将被排除在敏感数据分类之外。当TRUE时,视图将与表一起自动分类。
标签映射¶
将一个或多个用户定义的标签映射到 SEMANTIC_CATEGORY 系统标签的 OBJECT。
'column_tag_map': [ ... ]具有以下键值对的对象数组:
'tag_name': 'string'标签的完全限定名称。
有关更多信息,请参阅 标识符要求。
'tag_value':'string'标签的字符串值。
可选:如果未指定,则还必须省略
semantic_categories键。如果省略,tag_name标签将应用于 SEMANTIC_CATEGORY 系统标签所应用的每一列,且用户定义的标签值将与 SEMANTIC_CATEGORY 标签值相匹配。'semantic_categories': [ 'category' [ , 'category' ... ] ]A comma-separated list of native categories. The
tag_nameuser-defined tag is mapped to instances where the value of the SEMANTIC_CATEGORY tag is one of the specified native categories.可选:如果未指定,则还必须省略
tag_value键。如果省略,tag_name标签将应用于 SEMANTIC_CATEGORY 系统标签所应用的每一列,且用户定义的标签值将与 SEMANTIC_CATEGORY 标签值相匹配。
访问控制要求¶
权限/角色 |
对象 |
|---|---|
CLASSIFICATION_ADMIN 数据库角色 |
不适用 |
CREATE SNOWFLAKE.DATA_PRIVACY.CLASSIFICATION_PROFILE 权限 |
架构 |
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.
有关创建具有指定权限集的自定义角色的说明,请参阅 创建自定义角色。
方法¶
您可以对您创建的 CLASSIFICATION_PROFILE 类实例调用以下方法:
<classification_profile_name>!SET_ENABLE_TAG_BASED_SENSITIVE_DATA_EXCLUSION
<classification_profile_name>!SET_MAXIMUM_CLASSIFICATION_VALIDITY_DAYS
<classification_profile_name>!SET_MINIMUM_OBJECT_AGE_FOR_CLASSIFICATION_DAYS
<classification_profile_name>!SET_SNOWFLAKE_SEMANTIC_CATEGORIES
<classification_profile_name>!UNSET_MAXIMUM_CLASSIFICATION_VALIDITY_DAYS
<classification_profile_name>!UNSET_SNOWFLAKE_SEMANTIC_CATEGORIES
使用说明¶
执行 CREATE OR REPLACE 命令会从所有数据库和架构中移除分类配置文件,从而关闭自动分类。
要通过其非限定名称引用该类,请在 搜索路径 中包含该类的数据库和架构。
如果同一个标签和语义类别映射到两个不同的值,那么
column_tag_map中对象顺序决定了要在列上设置的标签和字符串值。按优先级从高到低排列column_tag_map数组。
示例¶
创建一个实例并指定基本标准以自动对数据库中的表进行分类:
CREATE OR REPLACE SNOWFLAKE.DATA_PRIVACY.CLASSIFICATION_PROFILE
my_classification_profile(
{
'minimum_object_age_for_classification_days': 0,
'maximum_classification_validity_days': 30,
'auto_tag': true,
'classify_views': false
});
创建一个实例并指定将标签映射到单个标签:
CREATE SNOWFLAKE.DATA_PRIVACY.CLASSIFICATION_PROFILE my_classification_profile(
{
'minimum_object_age_for_classification_days':0,
'auto_tag':true,
'tag_map':{
'column_tag_map':[
{
'tag_name':'tag_db.sch.pii'
}
]
}
}
);
创建一个实例并指定将标签映射到不同的标签值:
CREATE OR REPLACE SNOWFLAKE.DATA_PRIVACY.CLASSIFICATION_PROFILE
my_classification_profile(
{
'minimum_object_age_for_classification_days':0,
'auto_tag':true,
'tag_map': {
'column_tag_map':[
{
'tag_name':'test_ac_db.test_ac_schema.pii',
'tag_value':'important',
'semantic_categories':['NAME']
},
{
'tag_name':'test_ac_db.test_ac_schema.pii',
'tag_value':'pii',
'semantic_categories':['EMAIL','NATIONAL_IDENTIFIER']
}
]
}
}
);
Create an instance and specify custom classifiers for the sensitive data classification process:
CREATE SNOWFLAKE.DATA_PRIVACY.CLASSIFICATION_PROFILE my_classification_profile(
{
'minimum_object_age_for_classification_days':0,
'auto_tag':true,
'custom_classifiers': {
'medical_codes': medical_codes!list(),
'finance_codes': finance_codes!list()
}
}
);