動態資料遮罩系統檢視 - Amazon Redshift

從 2025 年 11 月 1 日起,Amazon Redshift 將不再支援建立新的 Python UDFs。如果您想要使用 Python UDFs,請在該日期之前建立 UDFs。現有的 Python UDFs將繼續如常運作。如需詳細資訊,請參閱部落格文章

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

動態資料遮罩系統檢視

超級使用者、具有 sys:operator角色的使用者,以及具有 ACCESS SYSTEM TABLE 許可的使用者,都可以存取下列 DDM 相關系統檢視。

  • SVV_MASKING_POLICY

    使用 SVV_MASKING_POLICY 來檢視在叢集或工作群組上建立的所有遮罩政策。

  • SVV_ATTACHED_MASKING_POLICY

    使用 SVV_ATTACHED_MASKING_POLICY 來檢視連接到目前連線資料庫的政策的所有關係和使用者或角色。

  • SYS_APPLIED_MASKING_POLICY_LOG

    使用 SYS_APPLIED_MASKING_POLICY_LOG 在參考 DDM 保護關係的查詢上追蹤遮罩政策的應用程式。

以下是您可以使用系統檢視找到的一些資訊範例。

--Select all policies associated with specific users, as opposed to roles SELECT policy_name, schema_name, table_name, grantee FROM svv_attached_masking_policy WHERE grantee_type = 'user'; --Select all policies attached to a specific user SELECT policy_name, schema_name, table_name, grantee FROM svv_attached_masking_policy WHERE grantee = 'target_grantee_name' --Select all policies attached to a given table SELECT policy_name, schema_name, table_name, grantee FROM svv_attached_masking_policy WHERE table_name = 'target_table_name' AND schema_name = 'target_schema_name'; --Select the highest priority policy attachment for a given role SELECT samp.policy_name, samp.priority, samp.grantee, smp.policy_expression FROM svv_masking_policy AS smp JOIN svv_attached_masking_policy AS samp ON samp.policy_name = smp.policy_name WHERE samp.grantee_type = 'role' AND samp.policy_name = mask_get_policy_for_role_on_column( 'target_schema_name', 'target_table_name', 'target_column_name', 'target_role_name') ORDER BY samp.priority desc LIMIT 1; --See which policy a specific user will see on a specific column in a given relation SELECT samp.policy_name, samp.priority, samp.grantee, smp.policy_expression FROM svv_masking_policy AS smp JOIN svv_attached_masking_policy AS samp ON samp.policy_name = smp.policy_name WHERE samp.grantee_type = 'role' AND samp.policy_name = mask_get_policy_for_user_on_column( 'target_schema_name', 'target_table_name', 'target_column_name', 'target_user_name') ORDER BY samp.priority desc; --Select all policies attached to a given relation. SELECT policy_name, schema_name, relation_name, database_name FROM sys_applied_masking_policy_log WHERE relation_name = 'relation_name' AND schema_name = 'schema_name';