DataQualityRule

Updated at:

Parameter

Type

Description

Example

object

The data quality rule.

Id

integer

The rule ID.

1

Name

string

The rule name. The name can contain digits, English letters, Chinese characters, and half-width or full-width punctuation marks. The name can be up to 255 characters in length.

Table cannot be empty

TenantId

integer

The DataWorks tenant ID.

1

ProjectId

integer

The DataWorks workspace ID.

100

Enabled

boolean

Indicates whether the rule is enabled.

true

Severity

string

The severity level of the rule for business, which corresponds to strong and weak rules on the page. Valid values:

  • Normal

  • High

High

Description

string

The rule description. The description can be up to 500 characters in length.

this is a odps _sql task

TemplateCode

string

The rule template referenced when creating the rule.

SYSTEM:user_defined_sql

Target

object

The object monitored by the rule.

Type

string

The monitored object type. Valid values:

  • Table

Table

DatabaseType

string

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

  • maxcompute

  • emr

  • cdh

  • hologres

  • analyticdb_for_postgresql

  • analyticdb_for_mysql

  • starrocks

maxcompute

TableGuid

string

The unique ID of the table in Data Map.

odps.unit_test.tb_unit_test

PartitionSpec

string

The partition settings of the partitioned table.

ds=$[yyyymmdd-1]

SamplingConfig

object

The settings required for sample collection.

Metric

string

The sampling metric name. Valid values:

  • Count: the number of table rows.

  • 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 in the field.

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

  • DuplicatedCount: the number of duplicate values in the 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 percentage of rows where the field is null.

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

  • CountNotIn: the number of rows that do not match the enumerated values.

  • CountDistinctNotIn: the number of unique values that do not match the enumerated values.

  • UserDefinedSql: sample collection through a custom SQL statement.

Min

MetricParameters

string

The parameters required for sample collection.

{ "Columns": [ "id", "name" ] }

SettingConfig

string

The runtime parameter setting statements to be executed before the sampling statement. The value can be up to 1000 characters in length. Currently, only MaxCompute is supported.

SET odps.sql.udf.timeout=600s;

SamplingFilter

string

The filter condition for secondary filtering of irrelevant data during sampling. The value can be up to 16,777,215 characters in length.

id IS NULL

CheckingConfig

object

The sample verification settings.

Type

string

The threshold calculation method. Valid values:

  • Fixed

  • Fluctation

  • FluctationDiscreate

  • Auto

  • Average

  • Variance

Fixed

ReferencedSamplesFilter

string

Some threshold types require querying reference samples and then aggregating the values of these samples to derive the comparison threshold. This parameter uses an expression to specify how to query the reference samples.

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

Thresholds

object

The threshold settings.

Expected

object

The expected threshold settings.

Value

string

The threshold value.

100.0

Operator

string

The comparison operator. Valid values:

  • />

  • />=

  • <

  • <=

  • !=

  • =

>

Expression

string

The threshold expression.

Used for fluctuation-type rules. The threshold is expressed through an expression. For example, 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

Warned

object

The warning threshold settings.

Value

string

The threshold value.

100.0

Operator

string

The comparison operator. Valid values:

  • />

  • />=

  • <

  • <=

  • !=

  • =

>

Expression

string

The threshold expression.

Used for fluctuation-type rules. The threshold is expressed through an expression. For example, 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

Critical

object

The critical warning threshold settings.

Value

string

The threshold value.

100.0

Operator

string

The comparison operator. Valid values:

  • />

  • />=

  • <

  • <=

  • !=

  • =

>

Expression

string

The verification expression.

Used for fluctuation-type rules. The threshold is expressed through an expression. For example, 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

ErrorHandlers

array

The quality rule check issue handlers.

object

Type

string

The handler type. Valid values:

  • SaveErrorData

SaveErrorData

ErrorDataFilter

string

The SQL statement specified by the user to filter problematic data. This parameter is required for custom SQL rules.

SELECT * FROM tb_api_log WHERE id IS NULL