Ask Your Question
4

How can I use a Snowflake query to find an object based on a specific tag value?

asked 2022-06-23 11:00:00 +0000

devzero gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2021-11-13 07:00:00 +0000

bukephalos gravatar image

To find an object in Snowflake based on a specific tag value, you can use the following query:

SELECT *
FROM INFORMATION_SCHEMA.OBJECTS
WHERE OBJECT_TYPE = 'TABLE'
AND OBJECT_ID IN (
  SELECT DISTINCT TAG_OBJECT_ID
  FROM "SNOWFLAKE"."ACCOUNT_USAGE"."TAGS"
  WHERE TAG_NAME = '<tag_name>'
  AND TAG_VALUE = '<tag_value>'
);

Replace <tag_name> and <tag_value> with the name and value of the tag you want to search for. This query searches for tables with a specific tag value, but you can modify the OBJECT_TYPE parameter to search for views or other types of objects.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-06-23 11:00:00 +0000

Seen: 6 times

Last updated: Nov 13 '21