UpdateDataQualityRule

Updated at:

Updates a quality rule.

Note

This API has been deprecated. We recommend migrating to dataworks-public(2024-05-18) - UpdateDataQualityScan for enhanced functionality and continued support. While the deprecated API remains temporarily accessible, no further updates or bug fixes will be provided.

Operation description

You must purchase DataWorks Basic Edition or a later edition to use this operation.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

Id

integer

Yes

The ID of the rule.

100001

Name

string

No

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

Table cannot be empty

Enabled

boolean

No

Specifies whether the rule is enabled.

true

Severity

string

No

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

  • Normal

  • High

Valid values:

  • High :

    High.

  • Normal :

    Normal.

High

Description

string

No

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

this is a odps _sql task

ProjectId

integer

Yes

The ID of the DataWorks workspace. You can log on to the DataWorks console and go to the Workspace Configuration page to obtain the workspace ID.

10000

TemplateCode

string

No

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

SYSTEM:table:table_count:fixed

SamplingConfig

object

No

The settings required for sample collection.

Metric

string

No

The name of the sampling metric. This parameter is optional when a template is used. Valid values:

  • Count: number of rows in the table

  • Min: minimum value of the field

  • Max: maximum value of the field

  • Avg: average value of the field

  • DistinctCount: number of unique values in the field

  • DistinctPercent: ratio of the number of unique values in the field to the number of data rows

  • DuplicatedCount: number of duplicate values in the field

  • DuplicatedPercent: ratio of the number of duplicate values in the field to the number of data rows

  • TableSize: size of the table

  • NullValueCount: number of rows where the field is null

  • NullValuePercent: ratio of rows where the field is null

  • GroupCount: number of data rows corresponding to each value after aggregation by field value

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

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

  • UserDefinedSql: sample collection by using custom SQL statements

Min

MetricParameters

string

No

The parameters required for sample collection.

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

SettingConfig

string

No

The runtime parameter setting statements that are inserted and executed before the sampling statements are executed. It can be up to 1,000 characters in length. Only MaxCompute is supported.

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

SamplingFilter

string

No

The condition used to filter out unneeded data during sampling. It can be up to 16,777,215 characters in length.

id IS NULL

CheckingConfig

object

No

The sample check settings.

Type

string

No

The threshold calculation method. This parameter is optional when a template is used. Valid values:

  • Fixed

  • Fluctation

  • FluctationDiscreate

  • Auto

  • Average

  • Variance

Fixed

ReferencedSamplesFilter

string

No

For some types of thresholds, reference samples must be queried, and the values of the reference samples are aggregated to obtain the threshold for comparison. This parameter uses an expression to specify the query method for the reference samples.

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

Thresholds

object

No

The threshold settings.

Expected

object

No

The expected threshold settings.

Operator

string

No

The comparison operator. Valid values:

  • >

  • >=

  • <

  • <=

  • !=

  • =

>

Value

string

No

The threshold value.

100.0

Expression

string

No

The threshold expression. For fluctuation rules, you must use an expression to specify 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 the fluctuation rate: abs($checkValue) > 0.01 For fixed value rules, you can also use an expression to configure the threshold. If both are configured, the expression takes precedence over the Operator and Value parameters.

$checkValue <= 0.01

Warned

object

No

The threshold settings for common warnings.

Operator

string

No

The comparison operator. Valid values:

  • >

  • >=

  • <

  • <=

  • !=

  • =

>

Value

string

No

The threshold value.

100.0

Expression

string

No

The threshold expression. For fluctuation rules, you must use an expression to specify 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 the fluctuation rate: abs($checkValue) > 0.01 For fixed value rules, you can also use an expression to configure the threshold. If both are configured, the expression takes precedence over the Operator and Value parameters.

$checkValue > 0.01

Critical

object

No

The threshold settings for critical warnings.

Operator

string

No

The comparison operator. Valid values:

  • >

  • >=

  • <

  • <=

  • !=

  • =

>

Value

string

No

The threshold value.

100.0

Expression

string

No

The threshold expression. For fluctuation rules, you must use an expression to specify 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 the fluctuation rate: abs($checkValue) > 0.01 For fixed value rules, you can also use an expression to configure the threshold. If both are configured, the expression takes precedence over the Operator and Value parameters.

$checkValue > 0.05

ErrorHandlers

array<object>

No

The list of error handlers for quality rule check issues.

object

No

The error handler for quality rule check issues.

Type

string

No

The type of the error handler. Valid values:

  • SaveErrorData

SaveErrorData

ErrorDataFilter

string

No

If the rule is a custom SQL rule, you must specify an SQL statement to filter the error data.

SELECT * FROM tb_api_log WHERE id IS NULL

Response elements

Element

Type

Description

Example

object

The response parameters.

RequestId

string

Id of the request

691CA452-D37A-4ED0-9441

Success

boolean

Indicates whether the update was successful.

true

Examples

Success response

JSON format

{
  "RequestId": "691CA452-D37A-4ED0-9441\n",
  "Success": true
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.