SHOW MASKING POLICIES¶
列出掩码策略信息,包括创建日期、数据库和架构名称、所有者以及任何可用注释。
- 另请参阅:
语法¶
SHOW MASKING POLICIES [ LIKE '<pattern>' ]
[ IN
{
ACCOUNT |
DATABASE |
DATABASE <database_name> |
SCHEMA |
SCHEMA <schema_name> |
<schema_name>
APPLICATION <application_name> |
APPLICATION PACKAGE <application_package_name> |
}
]
参数¶
LIKE 'pattern'(可选)按对象名称筛选命令输出。筛选器使用 不区分大小写 的模式匹配,并支持 SQL 通配符(
%和_)。例如,以下模式返回 相同的 结果:
... LIKE '%testing%' ...... LIKE '%TESTING%' .... 默认:无值(不对输出应用筛选)。
[ IN ... ](可选)指定命令的作用域。指定以下任一项:
ACCOUNT返回整个账户的记录。
DATABASE、.DATABASE db_name返回当前正在使用的数据库或指定数据库 (
db_name) 的记录。如果指定
DATABASE而不指定db_name,并且没有使用任何数据库,则关键字对输出没有影响。备注
在数据库上下文中使用不带
IN子句的 SHOW 命令,这样可能会导致结果低于预期。如果不使用
IN子句,则具有相同名称的多个对象只会显示一次。例如,如果您在schema1中具有表t1且在schema2中具有表t1,并且两者都在您指定的数据库上下文的作用域内(即,您所选的数据库是schema1和schema2的父级),则 SHOW TABLES 只会显示其中一个t1表。SCHEMA、.SCHEMA schema_name返回当前正在使用的架构或指定架构 (
schema_name) 的记录。如果数据库正在使用中,或者指定了完全限定
schema_name(例如db.schema),则SCHEMA是可选选项。如果未使用任何数据库,则指定
SCHEMA对输出没有影响。
APPLICATION application_name、.APPLICATION PACKAGE application_package_name返回命名的 Snowflake Native App 或应用程序包的记录。
If you omit
IN ..., the scope of the command depends on whether the session currently has a database in use:If a database is currently in use, the command returns the objects you have privileges to view in the database. This has the same effect as specifiying
IN DATABASE.If no database is currently in use, the command returns the objects you have privileges to view in your account. This has the same effect as specifiying
IN ACCOUNT.
访问控制要求¶
用于执行此 SQL 命令的 角色 必须至少具有以下 一项 权限:
权限 |
对象 |
备注 |
|---|---|---|
APPLY MASKING POLICY |
账户 |
|
APPLY |
掩码策略 |
|
OWNERSHIP |
掩码策略 |
OWNERSHIP is a special privilege on an object that is automatically granted to the role that created the object, but can also be transferred using the GRANT OWNERSHIP command to a different role by the owning role (or any role with the MANAGE GRANTS privilege). |
The USAGE privilege on the parent database and schema are required to perform operations on any object in a schema. Note that a role granted any privilege on a schema allows that role to resolve the schema. For example, a role granted CREATE privilege on a schema can create objects on that schema without also having USAGE granted on that schema.
有关创建具有指定权限集的自定义角色的说明,请参阅 创建自定义角色。
有关对 安全对象 执行 SQL 操作的相应角色和权限授予的一般信息,请参阅 访问控制概述。
有关掩码策略 DDL 和权限的其他详细信息,请参阅 管理列级安全性。
使用说明¶
将掩码策略属性
EXEMPT_OTHER_POLICIES设置为FALSE时,则 OPTIONS 列返回空字符串(即"")。
该命令不需要正在运行的仓库即可执行。
该命令仅返回当前用户的当前角色已获授至少一项访问权限的对象。
MANAGE GRANTS 访问权限隐式允许其持有者查看账户中的每个对象。默认情况下,只有账户管理员(具有 ACCOUNTADMIN 角色的用户)和安全管理员(具有 SECURITYADMIN 角色的用户)才具有 MANAGE GRANTS 权限。
To post-process the output of this command, you can use the pipe operator (
->>) or the RESULT_SCAN function. Both constructs treat the output as a result set that you can query.The output column names for this command are generated in lowercase. If you consume a result set from this command with the pipe operator or the RESULT_SCAN function, use double-quoted identifiers for the column names in the query to ensure that they match the column names in the output that was scanned. For example, if the name of an output column is
type, then specify"type"for the identifier.
LIMIT rows的值不能超过10000。如果省略LIMIT rows,若结果集大于 1 万行,则该命令将导致错误。要查看存在超过 1 万条记录的结果,请在 Snowflake Information Schema 中包含
LIMIT rows或查询相应的视图。
示例¶
SHOW MASKING POLICIES IN SCHEMA governance.policies;
+-------------------------------+------------+---------------+-------------+----------------+---------------+------------------------------+-----------------------------------+-----------------+
| created_on | name | database_name | schema_name | kind | owner | comment | options | owner_role_type |
+-------------------------------+------------+---------------+-------------+----------------+---------------+------------------------------+-----------------------------------+-----------------+
| 2022-08-13 16:59:59.733 +0000 | EMAIL_MASK | GOVERNANCE | POLICIES | MASKING_POLICY | MASKING_ADMIN | SPECIFY IN ROW ACCESS POLICY | {“EXEMPT_OTHER_POLICIES”: "TRUE"} | ROLE |
+-------------------------------+------------+---------------+-------------+----------------+---------------+------------------------------+-----------------------------------+-----------------+