Skip to main content

COLUMN_MASKS

check marked yes Databricks Runtime 12.2 LTS and above check marked yes Unity Catalog only.

Preview

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.

NameData typeNullableDescription
CATALOG_NAMESTRINGNoCatalog that contains the table.
SCHEMA_NAMESTRINGNoSchema that contains the table.
TABLE_NAMESTRINGNoName of the table the column is part of.
COLUMN_NAMESTRINGNoThe column that the masks applies to.
MASK_CATALOGSTRINGNoCatalog that contains the mask function.
MASK_SCHEMASTRINGNoSchema that contains the mask function.
MASK_NAMESTRINGNoThe specific name of the function implementing the mask.
MASK_COL_USAGESTRINGYesA comma separated list of additional columns passed to the masking function. NULL if none.

Constraints

The following constraint applies to the COLUMN_TAGS relation:

ClassNameColumn ListDescription
Primary keyCOLUMN_MASKS_PKCATALOG_NAME, SCHEMA_NAME, TABLE_NAME, COLUMN_NAMEUnique identifier for a column mask.
Foreign keyCOLUMN_MASKS_COLUMNS_FKCATALOG_NAME, SCHEMA_NAME, TABLE_NAME, COLUMN_NAMEReferences COLUMNS
Foreign keyCOLUMN_MASKS_ROUTINES_FKMASK_CATALOG, MASK_SCHEMA, MASK_NAMEReferences ROUTINES

Example

SQL
-- 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;