Schema:

ACCOUNT_USAGE

TAG_REFERENCES View

This Account Usage view can be used to identify the associations between objects and tags.

This view only records the direct relationship between the object and the tag. Tag lineage is not included in this view.

The view is complementary to the information schema table function TAG_REFERENCES.

Columns

Column Name

Data Type

Description

TAG_DATABASE

TEXT

The database in which the tag is set.

TAG_SCHEMA

TEXT

The schema in which the tag is set.

TAG_ID

NUMBER

Internal/system-generated identifier for the tag.

TAG_NAME

TEXT

The name of the tag. This is the key in the key = 'value' pair of the tag.

TAG_VALUE

TEXT

The value of tag. This is the 'value' in the key = 'value' pair of the tag.

OBJECT_DATABASE

TEXT

Database name of the referenced object for database and schema objects. If the object is not a database or schema object, the value is empty.

OBJECT_SCHEMA

TEXT

Schema name of the referenced object (for schema objects). If the referenced object is not a schema object (e.g. warehouse), this value is empty.

OBJECT_ID

NUMBER

Internal identifier of the referenced object.

OBJECT_NAME

TEXT

Name of the referenced object if the tag association is on the object. If the tag association is on a column, Snowflake returns the parent table name.

OBJECT_DELETED

TIMESTAMP_LTZ

Date and time when the associated object or column was dropped, or if the parent object is dropped.

DOMAIN

TEXT

Domain of the reference object (e.g. table, view) if the tag association is on the object. For columns, the domain is COLUMN if the tag association is on a column.

COLUMN_ID

NUMBER

The local identifier of the reference column; not applicable if the tag association is not a column.

COLUMN_NAME

TEXT

Name of the referenced column; not applicable if the tag association is not a column.

Usage Notes

  • Latency for the view may be up to 120 minutes (2 hours).

  • The view only displays objects for which the current role for the session has been granted access privileges.

  • The TAG_DATABASE_ID column is not included in this view. To obtain this value in your query result, perform a JOIN operation with the TAGS View.

Examples

Return the tag references for your Snowflake account:

select * from snowflake.account_usage.tag_references
order by tag_name, domain, object_id;

Return the active objects that have tag associations in your Snowflake account. The addition of the specified WHERE clause filters the objects that are deleted but not yet purged from the system:

select * from snowflake.account_usage.tag_references
where object_deleted = null
order by tag_name, domain, object_id;