COLUMN_MASKS

![check marked yes](../../../_static/images/icons/check.png Databricks Runtime 12.2 and above ![check marked yes](../../../_static/images/icons/check.png Unity Catalog only.)

Important

This feature is in Public Preview.

INFORMATION_SCHEMA.COLUMN_MASKS contains the column masking metadata for table columns in the catalog, or all catalogs if owned by the SYSTEM catalog.

Information is displayed only for columns the user has permission to interact with.

This relation is an extension to the SQL Standard Information Schema.

Definition

The COLUMN_MASKS relation contains the following.

Name Data type Nullable Description
CATALOG_NAME STRING No Catalog that contains the table.
SCHEMA_NAME STRING No Schema that contains the table.
TABLE_NAME STRING No Name of the table the column is part of.
COLUMN_NAME STRING No The column that the masks applies to.
MASK_CATALOG STRING No Catalog that contains the mask function.
MASK_SCHEMA STRING No Schema that contains the mask function.
MASK_NAME STRING No The specific name of the function implementing the mask.
MASK_COL_USAGE STRING Yes A comma separated list of additional columns passed to the masking function. NULL if none.

Constraints

The following constraint applies to the COLUMN_TAGS relation:

Class Name Column List Description
Primary key COLUMN_MASKS_PK CATALOG_NAME, SCHEMA_NAME, TABLE_NAME, COLUMN_NAME Unique identifier for a column mask.
Foreign key COLUMN_MASKS_COLUMNS_FK CATALOG_NAME, SCHEMA_NAME, TABLE_NAME, COLUMN_NAME References COLUMNS
Foreign key COLUMN_MASKS_ROUTINES_FK MASK_CATALOG, MASK_SCHEMA, MASK_NAME References ROUTINES

Example

-- Return the names of all functions used as column masks in the current catalog.
> SELECT mask_catalog, mask_schema, mask_name, count(1)
    FROM information_schema.column_masks
    GROUP BY ALL
    ORDER BY ALL;