I have been looking for a way of querying Snowflake tags and their belongings like schema, table, view, and column, as well as the masking policies, applied. The easiest way to do it is by querying it from the account_usage schema as below. Only some people have the account_admin role assigned, so we cannot use this option.
select * from snowflake.account_usage.tags
order by tag_name;
select * from snowflake.account_usage.tag_references
order by tag_name;
I have been checking the options and querying them from the information schema, but I have to write input to make it happen like below.
I would use
show tables
And then use the listed tables below, but it does not allow me to write a variable where the "DimCustomer" is.
select *
from table(information_schema.tag_references_all_columns('"DimCustomer"', 'table'))
For the policies;
select *
from table (information_schema.policy_references(
POLICY_NAME => 'CUST_KEY_MASK')
);
Considering that If I had not known dim_customers has a tag and had not known the tag has the CUST_KEY_MASK policy, how would I list all the tagged objects and applied to the masking policies?
As a summary:
1- List all the objects, tables, views
2- List all the objects with their tag applied
3- List all the objects, their tag, and the tag policies applied.
Could you please help me with this?
Many thanks,
Hazal
It is possible to grant access to
SNOWFLAKEdata share andACCOUNT_USAGEschema to other roles.If more granular permissions assignment is required then:
The Tags view is available for
OBJECT_VIEWERRole andGOVERNANCE_VIEWERRole