Schema:

ACCOUNT_USAGE

JOIN_POLICIES 视图

This Account Usage view lists the join policies in your account.

此视图中的每一行对应不同的联接策略。

Column NameData TypeDescription
POLICY_IDNUMBERInternal/system-generated identifier for the policy.
POLICY_NAMEVARCHARName of the policy.
POLICY_SCHEMA_IDNUMBERInternal/system-generated identifier for the schema in which the policy resides.
POLICY_SCHEMAVARCHARSchema that contains the policy.
POLICY_CATALOG_IDNUMBERInternal/system-generated identifier for the database in which the policy resides.
POLICY_CATALOGVARCHARDatabase to which the policy belongs.
POLICY_OWNERVARCHARName of the role that owns the policy.
POLICY_SIGNATUREVARCHARType signature of the policy’s arguments.
POLICY_RETURN_TYPEVARCHARReturn value data type.
POLICY_BODYVARCHARPolicy definition.
POLICY_COMMENTVARIANTComments entered for the policy (if any).
CREATEDTIMESTAMP_LTZDate and time when the policy was created.
LAST_ALTEREDTIMESTAMP_LTZDate and time when the policy was last altered.
DELETEDTIMESTAMP_LTZDate and time when the policy was dropped.
OWNER_ROLE_TYPEVARCHARThe type of role that owns the object, for example ROLE.
If a Snowflake Native App owns the object, the value is APPLICATION.
Snowflake returns NULL if you delete the object because a deleted object does not have an owner role.

使用说明

  • 视图的延迟时间最长可达 120 分钟(2 小时)。
  • 该视图仅显示会话的当前角色已被授予访问权限的对象。

示例

SELECT policy_name, policy_body, created
  FROM SNOWFLAKE.ACCOUNT_USAGE.JOIN_POLICIES
  WHERE policy_name='JP2' AND created LIKE '2024-11-26%';
+-------------+----------------------------------------------------------+-------------------------------+
| POLICY_NAME | POLICY_BODY                                              | CREATED                       |
|-------------+----------------------------------------------------------+-------------------------------|
| JP2         | CASE                                                     | 2024-11-26 11:22:54.848 -0800 |
|             |           WHEN CURRENT_ROLE() = 'ACCOUNTADMIN'           |                               |
|             |             THEN JOIN_CONSTRAINT(JOIN_REQUIRED => FALSE) |                               |
|             |           ELSE JOIN_CONSTRAINT(JOIN_REQUIRED => TRUE)    |                               |
|             |         END                                              |                               |
+-------------+----------------------------------------------------------+-------------------------------+