全部產品
Search
文件中心

DataWorks:GetDataQualityRuleTemplate

更新時間:Sep 03, 2026

查詢品質規則範本詳情。

說明

目前該API介面已標記為棄用,推薦使用替代API:dataworks-public(2024-05-18) - GetDataQualityTemplate。

介面說明

需要購買 DataWorks 基礎版及以上版本才能使用

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

當前API暫無授權資訊透出。

請求參數

名稱

類型

必填

描述

樣本值

Code

string

是

規則範本 Code。

USER_DEFINED:123

返回參數

名稱

類型

描述

樣本值

object

回傳值。

RequestId

string

API 請求 ID。

691CA452-D37A-4E****

DataQualityRuleTemplate

object

規則範本詳情。

Code

string

規則範本 Code。

USER_DEFINED:123

Name

string

規則範本名稱,數字、英文字母、漢字、半形全形標點符號組合,最長 512 個字元。

Table row Count Verification

ProjectId

integer

DataWorks 工作空間 ID。

4020

SamplingConfig

object

樣本擷取所需的設定。

Metric

string

The metrics used for sampling. Valid values:

  • Count: the number of rows in the table.

  • Min: the minimum value of the field.

  • Max: the maximum value of the field.

  • Avg: the average value of the field.

  • DistinctCount: the number of unique values of the field after deduplication.

  • DistinctPercent: the proportion of the number of unique values of the field after deduplication to the number of rows in the table.

  • DuplicatedCount: the number of duplicated values of the field.

  • DuplicatedPercent: the proportion of the number of duplicated values of the field to the number of rows in the table.

  • TableSize: the table size.

  • NullValueCount: the number of rows in which the field value is null.

  • NullValuePercent: the proportion of the number of rows in which the field value is null to the number of rows in the table.

  • GroupCount: the field value and the number of rows for each field value.

  • CountNotIn: the number of rows in which the field values are different from the referenced values that you specified in the rule.

  • CountDistinctNotIn: the number of unique values that are different from the referenced values that you specified in the rule after deduplication.

  • UserDefinedSql: indicates that data is sampled by executing custom SQL statements.

Max

MetricParameters

string

The parameters required for sampling.

{"SQL": "select count(1) from table;"}

SettingConfig

string

The statements that are used to configure the parameters required for sampling before you execute the sampling statements. The statements can be up to 1,000 characters in length. Only the MaxCompute database is supported.

SET odps.sql.udf.timeout=600s; SET odps.sql.python.version=cp27;

CheckingConfig

object

樣本校驗設定。

Type

string

The threshold calculation method. Valid values:

  • Fixed

  • Fluctation

  • FluctationDiscreate

  • Auto

  • Average

  • Variance

Fixed

ReferencedSamplesFilter

string

The method that is used to query the referenced samples. To obtain some types of thresholds, you need to query reference samples and perform aggregate operations on the reference values. In this example, an expression is used to indicate the query method of referenced samples.

{ "bizdate": [ "-1", "-7", "-1m" ] }

VisibleScope

string

範本的可用範圍:

  • Tenant:全租戶都可用

  • Project:只在目前專案中可用

Project

DirectoryPath

string

自訂範本被存放的類目目錄,斜線分隔層級。每個層級名稱最長 1024 個字元,不能包含空白字元、不能包含斜線。

/ods/order_data

樣本

正常返回樣本

JSON格式

{
  "RequestId": "691CA452-D37A-4E****",
  "DataQualityRuleTemplate": {
    "Code": "USER_DEFINED:123",
    "Name": "Table row Count Verification",
    "ProjectId": 4020,
    "SamplingConfig": {
      "Metric": "Max",
      "MetricParameters": "{\"SQL\": \"select count(1) from table;\"}",
      "SettingConfig": "SET odps.sql.udf.timeout=600s; \nSET odps.sql.python.version=cp27;\n"
    },
    "CheckingConfig": {
      "Type": "Fixed",
      "ReferencedSamplesFilter": "{ \"bizdate\": [ \"-1\", \"-7\", \"-1m\" ] }\n"
    },
    "VisibleScope": "Project",
    "DirectoryPath": "/ods/order_data"
  }
}

錯誤碼

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情。