- Schema:
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. Note that for system tags this value is NULL. |
TAG_NAME |
TEXT |
The name of the tag. This is the |
TAG_VALUE |
TEXT |
The value of tag. This is the |
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 was dropped, or if the parent object is dropped. . For more information, see the Usage notes section (in this topic). |
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. For more information, see supported domains. |
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.
The view does not capture tag references for replication and failover groups. Instead, use SYSTEM$GET_TAG to determine the tags that are set on replication and failover groups.
This column does not include the timestamp for a deleted column that had one or more tags set on the deleted column.
For reference, a deleted column results when one of the following events occur:
The column is dropped from the table (i.e.
ALTER TABLE ... DROP COLUMN col_name
), orThe parent table containing the column is dropped (i.e.
DROP TABLE name
), orThe parent schema containing the column is dropped (i.e.
DROP SCHEMA name
), orThe parent database containing the column is dropped (i.e.
DROP DATABASE name
).
Examples¶
Return the tag references for your Snowflake account:
select tag_name, tag_value, domain, object_id 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:
select tag_name, tag_value, domain, object_id from snowflake.account_usage.tag_references where object_deleted is null order by tag_name, domain, object_id;