Apply tags to Unity Catalog securable objects
This article shows how to apply tags in Unity Catalog.
Tags are attributes containing keys and optional values that you can apply to securable objects in Unity Catalog. Tagging is useful for organizing and categorizing securable objects in a metastore. Using tags also simplifies search and discovery of tables and views using the workspace search functionality.
Supported securable objects
Securable object tagging is currently supported on catalogs, schemas, tables, table columns, volumes, views, and registered models. For more information about securable objects, see Securable objects in Unity Catalog.
Requirements
To add tags to Unity Catalog securable objects, you must have the APPLY TAG
privilege on the object, as well as the USE SCHEMA
privilege on the object’s parent schema and the USE CATALOG
privilege on the object’s parent catalog.
Constraints
The following is a list of tag constraints:
You can assign a maximum of 20 tags to a single securable object.
The maximum length of a tag key is 255 characters.
The maximum length of a tag value is 1000 characters.
Special characters cannot be used in tag names.
Tag search using the workspace search UI is supported only for tables, views, and table columns.
Tag search requires exact term matching.
Manage tags in Catalog Explorer
To manage securable object tags using the Catalog Explorer UI you must have at least the BROWSE
privilege on the object.
Click Catalog in the sidebar.
Select a securable object to view the tag information.
Click Add/Edit Tags to manage tags for the current securable object. You can add and remove multiple tags simultaneously in the tag management modal.
To add or edit table column tags, click the Add tag icon.
Retrieve tag information in information schema tables
Each catalog created in Unity Catalog includes an INFORMATION_SCHEMA
. This schema includes tables that describe the objects known to the schema’s catalog. You must have the appropriate privileges to view the schema information.
You can query the following to retrieve tag information:
For more information, see Information schema.
Manage tags using SQL commands
Note
This feature is available only in Databricks Runtime versions 13.3 and above.
You can use SQL commands to tag catalogs, schemas, tables (views, materialized views, streaming tables), volumes, and table columns. For example, you can use the SET TAGS
and UNSET TAGS
clauses with the ALTER TABLE
command to manage tags on a table. See DDL statements for a list of available Data Definition Language (DDL) commands and their syntax.
Use tags to search for tables
You can use the Databricks workspace search bar to search for tables, views, and table columns using tag keys and tag values. You can use both table tags and table column tags. You cannot use tags to search for other tagged objects, like catalogs, schemas, or volumes.
For details, see Use tags to search for tables.