共用方式為


資料分類系統表格參考

這很重要

這項功能目前處於 公開預覽版

本頁概述資料分類結果表格結構描述,並包含範例查詢。 在您的中繼存放區中,此資料表會儲存已啟用目錄中資料行層級的敏感資料類別偵測結果。

表格路徑system.data_classification.results

資料分類結果資料表結構描述

資料分類結果系統表格使用下列結構描述:

欄位名稱 數據類型 Description Example
latest_detected_time 時間戳記 截至最近掃描欄位的時間點。 2025-06-27T12:34
first_detected_time 時間戳記 第一次記錄欄偵測的時間。 2025-06-27T12:34
catalog_id 字串 目錄的識別碼。 3f1a7d6e-9c59-...
table_id 字串 資料表的識別碼。 3f1a7d6e-9c59-...
catalog_name 字串 目錄名稱。 main_catalog
schema_name 字串 架構名稱。 public
table_name 字串 數據表名稱。 sales_data
column_name 字串 數據行名稱。 customer_email
data_type 字串 數據行的數據類型。 複雜類型包括完整的結構定義。 struct<name:string, age:int>
class_tag 字串 偵測到的實體或標籤索引鍵和選擇性值的標籤。 class.us_ssnpii: confidential
samples array<string> 最多五個符合偵測的樣本值。 ["a@b.com", ...]
confidence 字串 偵測的置信度。 不是HIGH就是LOW HIGH
frequency float 估計樣本中相符列的比例。 介於 0 和 1 之間。 0.87

範例查詢

在執行之前,請將參數值替換為您自己的。

取得資料表的所有偵測

SELECT *
FROM system.data_classification.results
WHERE
  catalog_name = "c"
  AND schema_name = "s"
  AND table_name = "t";

取得所有高信賴度偵測

SELECT *
FROM system.data_classification.results
WHERE
  catalog_name = "c"
  AND schema_name = "s"
  AND table_name = "t"
  AND confidence = "HIGH";

取得受特定分類影響的資料表數目

SELECT
  class_tag,
  COUNT(DISTINCT catalog_name, schema_name, table_name) AS num_tables
FROM
  system.data_classification.results
WHERE
  class_tag IS NOT NULL
GROUP BY class_tag;

取得過去 30 天內查詢包含敏感性資料的資料表的使用者數目

WITH table_accesses AS (
  SELECT
    IFNULL(
      request_params.full_name_arg,
      CONCAT(request_params.catalog_name, '.', request_params.schema_name, '.', request_params.name)
    ) AS table_full_name,
    COUNT(DISTINCT user_identity.email) AS num_users
  FROM
    system.access.audit
  WHERE
    action_name IN ("createTable", "getTable", "updateTable", "deleteTable")
    AND (
      -- For performance, limit the blast radius of the audit log query to only the current catalog
      request_params.catalog_name = :catalog_name OR
      request_params.full_name_arg LIKE :catalog_name || '%'
    )
    AND event_time >= DATE_SUB(current_date(), 30)
  GROUP BY table_full_name
),
sensitive_tables AS (
  SELECT
    DISTINCT CONCAT(catalog_name, '.', schema_name, '.', table_name) AS table_full_name
  FROM
    system.data_classification.results
  WHERE class_tag IS NOT NULL
)

SELECT
  st.table_full_name,
  ta.num_users
FROM
  sensitive_tables st
  JOIN table_accesses ta
  ON st.table_full_name = ta.table_full_name