全部產品
Search
文件中心

DataWorks:ListDataQualityRules

更新時間:Sep 03, 2026

以分頁方式查詢品質監控規則。

說明

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

介面說明

You must purchase DataWorks Basic Edition or a higher edition to use this feature.

調試

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

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

dataworks:*

list

*全部資源。

*

無 無

請求參數

名稱

類型

必填

描述

樣本值

ProjectId

integer

是

The DataWorks workspace ID.

10002

DataQualityEvaluationTaskId

integer

否

The ID of the associated quality check task.

10000

TableGuid

string

否

The unique identifier of the table that the rule applies to in DataWorks Data Map.

odps.unit_test.tb_unit_test

Name

string

否

The rule name for fuzzy matching.

unit_test

PageSize

integer

否

The number of entries per page. Default value: 10. Maximum value: 200.

10

PageNumber

integer

是

The page number for paging. Default value: 1.

1

返回參數

名稱

類型

描述

樣本值

object

The response parameters.

RequestId

string

The request ID.

691CA452-D37A-4ED0-9441

PagingInfo

object

The paginated query result of the rule list.

PageNumber

integer

The page number.

1

PageSize

integer

The page size.

10

TotalCount

integer

The total number of entries.

294

DataQualityRules

array<object>

The list of rules.

array<object>

Id

integer

The rule ID.

22130

Name

string

The rule name.

The table cannot be empty.

ProjectId

integer

The DataWorks workspace ID.

100001

Enabled

boolean

Indicates whether the quality rule is enabled.

true

Severity

string

The severity level of the rule for business (corresponding to strong/weak rules on the page). Valid values:

  • Normal

  • High

High

Description

string

The rule description. Maximum length: 500 characters.

this is a odps _sql task

Target

object

The object monitored by the rule.

Type

string

The monitored object type.

  • Table

Table

DatabaseType

string

The database type of the table for table-type datasets. Valid values:

  • maxcompute

  • emr

  • cdh

  • hologres

  • analyticdb_for_postgresql

  • analyticdb_for_mysql

  • starrocks

maxcompute

TableGuid

string

The unique ID of the table that the rule applies to in DataWorks Data Map.

odps.unit_test.tb_unit_test

TemplateCode

string

The unique identifier of the rule template referenced by the rule.

SYSTEM:user_defined_sql

SamplingConfig

object

The settings required for sample collection.

Metric

string

The metric name for sampling. Valid values:

  • Count: the number of table rows.

  • Min: the minimum value of a field.

  • Max: the maximum value of a field.

  • Avg: the average value of a field.

  • DistinctCount: the number of unique values in a field.

  • DistinctPercent: the ratio of unique values to the total number of rows.

  • DuplicatedCount: the number of duplicate values in a field.

  • DuplicatedPercent: the ratio of duplicate values to the total number of rows.

  • TableSize: the table size.

  • NullValueCount: the number of rows where the field is null.

  • NullValuePercent: the ratio of null values in a field.

  • GroupCount: the number of rows for each value after aggregation by field value.

  • CountNotIn: the number of rows with mismatched enumeration values.

  • CountDistinctNotIn: the number of unique values with mismatched enumeration values.

  • UserDefinedSql: sample collection through custom SQL.

Max

MetricParameters

string

The parameters required for sample collection.

{ "Columns": [ "id", "name" ] , "SQL": "select count(1) from table;"}

SettingConfig

string

The runtime parameter setting statements to execute before the sampling statement. Maximum length: 1000 characters. Currently, only MaxCompute is supported.

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

SamplingFilter

string

The filter condition for secondary filtering of irrelevant data during sampling. Maximum length: 16,777,215 characters.

id IS NULL

CheckingConfig

object

The sample check settings.

Type

string

The threshold calculation method. Valid values:

  • Fixed

  • Fluctation

  • FluctationDiscreate

  • Auto

  • Average

  • Variance

Fixed

ReferencedSamplesFilter

string

An expression that specifies how to query reference samples. Some threshold types require querying reference samples and aggregating their values to derive the comparison threshold.

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

Thresholds

object

The threshold settings.

Expected

object

The expected threshold settings.

Operator

string

The comparison operator. Valid values:

  • >

  • >=

  • <

  • <=

  • !=

  • =

>

Value

string

The threshold value.

100.0

Expression

string

The threshold expression.

For fluctuation-type rules, you must use an expression to represent the fluctuation threshold. Examples:

  • Fluctuation increase greater than 0.01: $checkValue > 0.01

  • Fluctuation decrease greater than 0.01: $checkValue < -0.01

  • Absolute value of fluctuation rate: abs($checkValue) > 0.01

For fixed-value-type rules, you can also use an expression to configure the threshold. If both are configured, the expression takes precedence over Operator and Value.

$checkValue > 0.01

Warned

object

The threshold settings for normal warnings.

Operator

string

The comparison operator. Valid values:

  • >

  • >=

  • <

  • <=

  • !=

  • =

>

Value

string

The threshold value.

100.0

Expression

string

The threshold expression.

For fluctuation-type rules, you must use an expression to represent the fluctuation threshold. Examples:

  • Fluctuation increase greater than 0.01: $checkValue > 0.01

  • Fluctuation decrease greater than 0.01: $checkValue < -0.01

  • Absolute value of fluctuation rate: abs($checkValue) > 0.01

For fixed-value-type rules, you can also use an expression to configure the threshold. If both are configured, the expression takes precedence over Operator and Value.

$checkValue > 0.01

Critical

object

The threshold settings for critical warnings.

Operator

string

The comparison operator. Valid values:

  • >

  • >=

  • <

  • <=

  • !=

  • =

>

Value

string

The threshold value.

100.0

Expression

string

The threshold expression.

For fluctuation-type rules, you must use an expression to represent the fluctuation threshold. Examples:

  • Fluctuation increase greater than 0.01: $checkValue > 0.01

  • Fluctuation decrease greater than 0.01: $checkValue < -0.01

  • Absolute value of fluctuation rate: abs($checkValue) > 0.01

For fixed-value-type rules, you can also use an expression to configure the threshold. If both are configured, the expression takes precedence over Operator and Value.

$checkValue > 0.01

ErrorHandlers

array<object>

The list of quality rule check error handlers.

object

The quality rule check error handler.

Type

string

The handler type. Valid values:

  • SaveErrorData

SaveErrorData

ErrorDataFilter

string

For custom SQL rules, the SQL statement specified by the user to filter error data.

SELECT * FROM tb_api_log WHERE id IS NULL

樣本

正常返回樣本

JSON格式

{
  "RequestId": "691CA452-D37A-4ED0-9441",
  "PagingInfo": {
    "PageNumber": 1,
    "PageSize": 10,
    "TotalCount": 294,
    "DataQualityRules": [
      {
        "Id": 22130,
        "Name": "The table cannot be empty.",
        "ProjectId": 100001,
        "Enabled": true,
        "Severity": "High",
        "Description": "this is a odps _sql task",
        "Target": {
          "Type": "Table",
          "DatabaseType": "maxcompute",
          "TableGuid": "odps.unit_test.tb_unit_test"
        },
        "TemplateCode": "SYSTEM:user_defined_sql",
        "SamplingConfig": {
          "Metric": "Max",
          "MetricParameters": "{ \"Columns\": [ \"id\", \"name\" ] , \"SQL\": \"select count(1) from table;\"}",
          "SettingConfig": "SET odps.sql.udf.timeout=600s; \nSET odps.sql.python.version=cp27;",
          "SamplingFilter": "id IS NULL"
        },
        "CheckingConfig": {
          "Type": "Fixed",
          "ReferencedSamplesFilter": "{ \"bizdate\": [ \"-1\", \"-7\", \"-1m\" ] }",
          "Thresholds": {
            "Expected": {
              "Operator": ">",
              "Value": "100.0",
              "Expression": "$checkValue > 0.01"
            },
            "Warned": {
              "Operator": ">",
              "Value": "100.0",
              "Expression": "$checkValue > 0.01"
            },
            "Critical": {
              "Operator": ">",
              "Value": "100.0",
              "Expression": "$checkValue > 0.01"
            }
          }
        },
        "ErrorHandlers": [
          {
            "Type": "SaveErrorData\n",
            "ErrorDataFilter": "SELECT * FROM tb_api_log WHERE id IS NULL"
          }
        ]
      }
    ]
  }
}

錯誤碼

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

變更歷史

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