0

如何获取雪花中特定帐户中创建的所有屏蔽策略?有什么观点可以看吗?

显示屏蔽策略只检索与策略相关的数据,而不是它的应用位置?

如何获取所有策略以及在哪些表的哪些列中应用它?

4

1 回答 1

2

You can query the information schema table-function POLICY_REFERENCES, see here: https://docs.snowflake.com/en/sql-reference/functions/policy_references.html

Here is also an example from the docs:

use database my_db;
use schema information_schema;
select *
  from table(information_schema.policy_references(policy_name => 'ssn_mask'));

Important: You have to execute the USE DATABASE ... and USE SCHEMA INFORMATION_SCHEMA commands or use a full qualified identifier.

If this is not enough, you can query all policies with all tables and all columns when you combine the query above with your SHOW MASKING POLICIES; and the RESULT_SCAN()-function. RESULT_SCAN() allows you to query the results of SHOW MASKING POLICIES; (https://docs.snowflake.com/en/sql-reference/functions/result_scan.html)

Consequence: You get all names of policies and for each of them you can call POLICY_REFERENCES().

于 2020-10-07T10:41:13.030 回答