SYSTEM$DATA_METRIC_SCAN¶
返回由 数据质量指标 标识为包含未通过数据质量检查的数据的行。例如,如果您将 NULL_COUNT 数据指标函数用作实参,则该函数将返回表中在特定列中包含 NULL 值的行。
语法¶
实参¶
必填:
REF_ENTITY_NAME => 'object'指定数据指标函数将运行的表或视图的名称。该函数返回此对象的行。
METRIC_NAME => 'data_metric_function'您想要运行以评估指定表或视图的系统数据指标名称。仅支持以下系统函数:
SNOWFLAKE.CORE.ACCEPTED_VALUES
SNOWFLAKE.CORE.BLANK_COUNT
SNOWFLAKE.CORE.BLANK_PERCENT
SNOWFLAKE.CORE.DUPLICATE_COUNT
SNOWFLAKE.CORE.NULL_COUNT
SNOWFLAKE.CORE.NULL_PERCENT
ARGUMENT_NAME => 'column [ , column ... ]'Name of the columns in the specified table or view that are being passed as arguments to the specified data metric function.
可选:
ARGUMENT_EXPRESSION => 'boolean-expression'Required if the specified data metric function is ACCEPTED_VALUES. Disallowed for all other DMFs.
Specifies a Boolean expression used to evaluate whether a record passes or fails the ACCEPTED_VALUES data quality check. The SYSTEM$DATA_METRIC_SCAN function returns records that do not match the Boolean expression. The expression can include the following operators and functions:
布尔表达式中的列必须与在 ARGUMENT_NAME 实参中指定的列相同。
If the ACCEPTED_VALUES DMF is associated with the object specified by REF_ENTITY_NAME, the SYSTEM$DATA_METRIC_SCAN function ignores the Boolean expression that was specified when ACCEPTED_VALUES was associated with the object.
AT_TIMESTAMP => 'timestamp'作为实参传递的时间戳,用于检查过去表或视图中 DMF 评估的结果。
返回¶
指定表或视图中的行。
访问控制权限¶
执行此函数需要以下权限:
指定表中的 SELECT。
指定数据指标函数中的 USAGE。
使用说明¶
此函数不支持用户定义的指标。
如果指定表受策略(如掩码策略或行访问策略)保护,则函数可能会返回意外或不完整的数据,因为结果取决于执行函数时用户的角色。
示例¶
考虑到 SNOWFLAKE.CORE.NULL_COUNT 系统指标返回特定列中 NULL 值的总数,以下返回 employeesTable 表中在 SSN 列中具有 NULL 值的行。
Given that the SNOWFLAKE.CORE.DUPLICATE_COUNT system metric returns the count of duplicate values, the following returns
the rows of the employeesTable table that had duplicate values in both the first_name and last_name columns.
返回 age 列的值 不 等于五的行(即与 ARGUMENT_EXPRESSION 所指定条件 不 匹配的行)。