Governed tags system table reference
This page describes the governed tags system table schema and includes sample queries. The table contains a record for each governed tag key in your account, including customer-created and system-generated tags. Use it to programmatically determine which tags in your account are governed.
Table path: system.tags.governed_tags
This system table is in Beta.
The governed tags system table contains the current snapshot of all governed tag definitions, including deleted ones. When a governed tag is deleted, its deleted_at timestamp is populated. To get the current list of governed tags, filter to rows where deleted_at is null. See Get the governed tags for the account.
Governed tags table schema
The governed tags system table uses the following schema:
Column name | Data type | Description | Example |
|---|---|---|---|
| string | The ID of the account this governed tag belongs to. |
|
| string | The ID of the governed tag, which is used for permission management. |
|
| string | The name of the governed tag key. |
|
| timestamp | The time when the governed tag was deleted. |
|
| timestamp | The time when the governed tag was most recently changed. |
|
The primary key is account_id combined with id.
Example queries
Replace parameter values with your own before running.
Get the governed tags for the account
Filter out deleted tags to get the current list of governed tags for your account:
SELECT
account_id,
id,
tag_key,
change_time
FROM system.tags.governed_tags
WHERE deleted_at IS NULL;
Use the result set as the canonical list of current governed tags for the account.
Identify which tag assignments are governed
Join the governed tags with the column tags in the information schema to determine which Unity Catalog tag assignments use a governed tag key:
WITH governed_tags AS (
SELECT account_id, id, tag_key
FROM system.tags.governed_tags
WHERE deleted_at IS NULL
),
assignments AS (
SELECT
catalog_name, schema_name, table_name, column_name, tag_name, tag_value
FROM system.information_schema.column_tags
)
SELECT
a.catalog_name,
a.schema_name,
a.table_name,
a.column_name,
a.tag_name,
a.tag_value,
CASE WHEN g.tag_key IS NOT NULL THEN TRUE ELSE FALSE END AS is_governed
FROM assignments a
LEFT JOIN governed_tags g
ON a.tag_name = g.tag_key;
Each column tag assignment includes is_governed = true when its tag key matches a governed tag key.