- Schema:
TAG_REFERENCES view¶
Important
This view is only available in the organization account. For more information, see Premium views in the organization account.
This Organization 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 |
---|---|---|
ORGANIZATION_NAME |
TEXT |
The name of the organization. |
ACCOUNT_LOCATOR |
VARCHAR |
The locator for the account (system-defined). |
ACCOUNT_NAME |
TEXT |
The name of the account (user-defined). |
TAG_DATABASE |
TEXT |
The database in which the tag is set. |
TAG_SCHEMA |
TEXT |
The schema in which the tag is set. |
TAG_ID |
VARCHAR |
|
TAG_NAME |
TEXT |
The name of the tag. This is the |
TAG_VALUE |
TEXT |
The value of tag. This is the |
OBJECT_DATABASE |
TEXT |
The 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 |
VARCHAR |
The 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 |
|
OBJECT_NAME |
VARCHAR |
The name of the referenced object if the tag association is on the object. |
OBJECT_DELETED |
TIMESTAMP_LTZ |
The date and time when the associated object was dropped, or the date and time when the parent object is dropped. . For more information see the Usage notes section (in this topic). |
DOMAIN |
TEXT |
The domain of the reference object (e.g. table, view). |
COLUMN_ID |
NUMBER |
|
COLUMN_NAME |
VARCHAR |
|
APPLY_METHOD |
VARCHAR |
|
Usage notes¶
Latency for the view may be up to 24 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.
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 account_name, tag_name, tag_value, domain, object_id from snowflake.organization_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 account_name, tag_name, tag_value, domain, object_id from snowflake.organization_usage.tag_references where object_deleted is null order by tag_name, domain, object_id;