System data metric functions

This topic is a reference for the system data metric functions (DMFs) that Snowflake provides to all accounts.

You can call these system DMFs to start measuring your data quality immediately.

About system DMFs

Snowflake provides system DMFs in the CORE schema of the shared SNOWFLAKE database. System DMFs are maintained by Snowflake; you cannot change the name or functionality of any system DMF.

Each system DMF enables you to measure a different data quality attribute. You can assign more than one system DMF to a table or view to allow for a more comprehensive data quality measurement to address your governance and compliance needs.

To use a system DMF, choose one of the following access control approaches:

  • Grant the DATA_METRIC_USER database role to the table owner role, which is the role with the OWNERSHIP privilege on the table. This database role has the USAGE privilege on the SNOWFLAKE.CORE schema and the USAGE privilege on all system DMFs in the SNOWFLAKE.CORE schema.

    Additionally, grant the privileges in this table to the table owner role:

    Privilege

    Object

    Notes

    EXECUTE DATA METRIC FUNCTION

    Account

    This privilege enables you to control which roles have access to serverless compute resources to call the system DMF.

    USAGE

    Database, schema

    These objects are the database and schema that contain the referenced table in the query.

  • Grant the privileges in the table to the table owner role and grant these privileges to the table owner role:

  • Use the ACCOUNTADMIN role.

Calling a system DMF

When you call a DMF manually, you must use a role that has the required privileges.

Use the following syntax to call a DMF:

SELECT <data_metric_function>(<query>)
Copy

Where:

data_metric_function

Specifies a system- or user-defined DMF.

query

Specifies a SQL query on a table or view.

The columns in the query must match the column arguments in the DMF signature.

Note

These system DMFs don’t follow this syntax because they don’t take any arguments:

For example, call the NULL_COUNT (system data metric function) system DMF to view the number of NULL values in the SSN column (US Social Security number):

USE ROLE data_engineer;
SELECT SNOWFLAKE.CORE.NULL_COUNT(
  SELECT ssn
  FROM hr.tables.empl_info
);
Copy

You can query the event table to view the results. For information, see View the DMF results.

Scheduling a system DMF

For more information, see Schedule your DMFs to run.

System DMFs

Currently, Snowflake supports these system DMFs to measure common metrics without having to define them:

Category

System DMFs

Notes

Accuracy

Freshness

  • Determine the freshness of column data.

  • Define custom freshness metrics.

Statistics

Uniqueness

  • Determine the number duplicate values in a column, including NULL values.

  • Determine the number of non-NULL values in a column.

Volume

Language: English