CreateDataQualityEvaluationTask

Updated at:

Creates a DataWorks data quality monitoring task.

Note

This API has been deprecated. We recommend migrating to dataworks-public(2024-05-18) - CreateDataQualityScan 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 later to use this feature.

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

Target

object

Yes

The monitored object for the data quality monitoring task.

DatabaseType

string

Yes

The database type of the table. Valid values:

  • maxcompute

  • hologres

  • cdh

  • analyticdb_for_mysql

  • starrocks

  • emr

  • analyticdb_for_postgresql

maxcompute

TableGuid

string

Yes

The unique ID of the table in DataWorks Data Map.

odps.api_test.ods_openapi_log_d

PartitionSpec

string

No

The partition settings for the partitioned table.

pt=$[yyyymmdd-1]

Description

string

No

The description of the data quality monitoring task.

OpenAPI create a data quality monitoring test

Name

string

Yes

The name of the data quality monitoring task.

OpenAPI create a data quality monitoring test

RuntimeConf

string

No

The extension configurations in JSON string format. This parameter takes effect only for EMR data quality monitoring tasks.

  • queue: the YARN queue used to execute EMR data validation. Default value: the queue configured for the project.

  • sqlEngine: the SQL engine used to execute EMR data validation. Valid values:
    • HIVE_SQL

    • SPARK_SQL

{ "queue": "default", "sqlEngine": "SPARK_SQL" }

Trigger

object

No

The trigger configuration for the data quality check task.

Type

string

No

The trigger type for the data quality monitoring task. Valid values:

  • ByManual: triggered manually. This is the default value.

  • ByScheduledTaskInstance: triggered by an associated scheduled task.

ByScheduledTaskInstance

TaskIds

array

No

The list of scheduled task IDs. This parameter takes effect only when Type is set to ByScheduledTaskInstance.

integer

No

The ID of the scheduled task.

30001

ProjectId

integer

Yes

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

This parameter is used to determine the DataWorks workspace used to invoke this API operation.

10000

Hooks

array<object>

No

The hook settings.

object

No

Hook

Type

string

No

The hook type. Only one type is supported:

  • BlockTaskInstance: blocks the scheduled task from continuing to run. If the data quality monitoring task is triggered by a scheduled task, the system determines whether to block the scheduled task based on Hook.Condition after the data quality monitoring task is completed.

BlockTaskInstance

Condition

string

No

The trigger condition for the hook. When this condition is met, the hook action is triggered. Two conditional expressions are supported:

  1. Specify only one group of rule severity and check status. Example: ${severity} == "High" AND ${status} == "Critical". This means that among the rules to execute, if the check result of a rule with the High severity is Critical, the condition is met.

  2. Specify multiple groups of rule severity and check status. Example: (${severity} == "High" AND ${status} == "Critical") OR (${severity} == "Normal" AND ${status} == "Critical") OR (${severity} == "Normal" AND ${status} == "Error"). This means that among the rules to execute, if the check result of a rule with the High severity is Critical, the check result of a rule with the Normal severity is Critical, or the check result of a rule with the Normal severity is Error, the condition is met. The valid values of severity in the conditional expression are the same as those in DataQualityRule, and the valid values of status are the same as those in DataQualityResult.

(${severity} == "High" AND ${status} == "Critical") OR (${severity} == "Normal" AND ${status} == "Critical") OR (${severity} == "Normal" AND ${status} == "Error")

Notifications

object

No

The notification subscription configuration.

Condition

string

No

The trigger condition for notifications. When this condition is met, a message notification is triggered. Two conditional expressions are supported:

Specify only one group of rule severity and check status. Example: ${severity} == "High" AND ${status} == "Critical". This means that among the rules to execute, if the check result of a rule with the High severity is Critical, the condition is met. Specify multiple groups of rule severity and check status. Example: (${severity} == "High" AND ${status} == "Critical") OR (${severity} == "Normal" AND ${status} == "Critical") OR (${severity} == "Normal" AND ${status} == "Error"). This means that among the rules to execute, if the check result of a rule with the High severity is Critical, the check result of a rule with the Normal severity is Critical, or the check result of a rule with the Normal severity is Error, the condition is met. The valid values of severity in the conditional expression are the same as those in DataQualityRule, and the valid values of status are the same as those in DataQualityResult.

(${severity} == "High" AND ${status} == "Critical") OR (${severity} == "Normal" AND ${status} == "Critical") OR (${severity} == "Normal" AND ${status} == "Error")

Notifications

array<object>

No

The notification settings.

array<object>

No

The notification settings.

NotificationReceivers

array<object>

No

The alert recipient settings.

object

No

The alert recipient settings.

ReceiverType

string

No

The type of the alert recipient. Valid values:

  • WebhookUrl: custom webhook URL

  • FeishuUrl: Lark alert URL

  • DingdingUrl: DingTalk alert URL

  • WeixinUrl: WeCom alert URL

  • AliUid: Alibaba Cloud user ID

DingdingUrl

Extension

string

No

The additional parameter settings in JSON format when an alert is sent. Supported keys:

  • atAll: specifies whether to @all in the group when sending a DingTalk alert. This key takes effect only when ReceiverType is set to DingdingUrl.

{ "atAll": true }

ReceiverValues

array

No

The alert recipients.

string

No

The value of the recipient.

  • If the recipient type is Alibaba Cloud user ID, the value is the specific Alibaba Cloud user ID.

  • If the recipient type is DingdingUrl, the value is the alert URL of the specific DingTalk chatbot.

  • If the recipient type is WeixinUrl, the value is the alert URL of the specific WeCom chatbot.

  • If the recipient type is FeishuUrl, the value is the alert URL of the specific Lark chatbot.

  • If the recipient type is WebhookUrl, the value is the alert URL of the specific custom webhook.

https://api.fc.aliyuncs.com/webhook

NotificationChannels

array<object>

No

The notification methods.

object

No

The notification methods.

Channels

array

No

The notification methods.

string

No

The alert methods. Valid values:

  • Mail: email

  • Sms: text message

  • Phone: phone call

  • Feishu: Lark

  • Weixin: WeChat

  • Dingding: DingTalk

  • Webhook: custom webhook

Mail

DataSourceId

integer

Yes

The ID of the data source. You can call the ListDataSources operation to query the ID of the data source.

1

DataQualityRules

array<object>

No

The list of data quality rules associated with the data quality monitoring task. If DataQualityRule.Id is specified, the rule corresponding to the ID is associated with the new quality monitoring task. If it is not specified, a new rule is created by using other fields and associated with the new quality monitoring task.

array<object>

No

Name

string

No

The name of the data quality rule.

OpenAPI test rules

Enabled

boolean

No

Specifies whether the quality rule is enabled.

true

Severity

string

No

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

  • Normal

  • High

Valid values:

  • High :

    High.

  • Normal :

    Normal.

High

Description

string

No

The description of the data quality rule.

OpenAPI test rules

TemplateCode

string

No

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

SYSTEM:field:null_value:fixed:0

SamplingConfig

object

No

The parameters required for sample collection.

Metric

string

No

The name of the sampling metric. 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 in the field.

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

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

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

  • TableSize: The size of the table.

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

  • NullValuePercent: The ratio of rows where the field is null.

  • GroupCount: The number of data rows corresponding to 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 by using custom SQL statements.

NullValueCount

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 inserted before the sampling statements are executed. The maximum length is 1,000 characters. Only MaxCompute is supported.

odps.sql.type.system.odps2=True,odps.sql.hive.compatible=True

SamplingFilter

string

No

The conditions for secondary filtering of irrelevant data during sampling. The maximum length is 16,777,215 characters.

status != 'Succeeded'

CheckingConfig

object

No

The sample verification settings.

Type

string

No

The threshold calculation method. Valid values:

  • Fixed

  • Fluctation

  • FluctationDiscreate

  • Auto

  • Average

Fixed

ReferencedSamplesFilter

string

No

The expression that represents the query method for reference samples. Some types of thresholds require querying reference samples and aggregating their values to obtain the threshold for comparison.

{"bizdate": ["-1"]}

Thresholds

object

No

The verification threshold settings.

Expected

object

No

The expected threshold settings.

Operator

string

No

The comparison operator. Valid values:

  • >

  • >=

  • <

  • <=

  • !=

  • =

=

Value

string

No

The threshold value.

0

Expression

string

No

The threshold expression.

For fluctuation 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

Fixed value rules can also use expressions to configure thresholds. If both are configured, the expression takes precedence over Operator and Value.

$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.

0.001

Expression

string

No

The threshold expression.

For fluctuation 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

Fixed value rules can also use expressions to configure thresholds. If both are configured, the expression takes precedence over Operator and Value.

$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.

0.01

Expression

string

No

The threshold expression.

For fluctuation 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

Fixed value rules can also use expressions to configure thresholds. If both are configured, the expression takes precedence over Operator and Value.

$checkValue > 0.01

ErrorHandlers

array<object>

No

The list of error handlers for quality rule verification.

object

No

The error handler for quality rule verification.

Type

string

No

The handler type. Valid values:

  • SaveErrorData: Retain problematic data.

SaveErrorData

ErrorDataFilter

string

No

The SQL statement specified by the user to filter problematic data if the rule is a custom SQL rule.

SELECT * FROM ods_api_log WHERE status = 'Error';

Id

integer

No

The rule ID.

2176

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

Id of the request

2d9ce-38ef-4923-baf6-391a7e656

Id

integer

The ID of the newly created data quality monitoring task.

10001

Examples

Success response

JSON format

{
  "RequestId": "2d9ce-38ef-4923-baf6-391a7e656",
  "Id": 10001
}

Error codes

HTTP status code

Error code

Error message

Description

400 IdempotentParameterMismatch The request uses the same client token as a previous, but non-identical request. Do not reuse a client token with different requests, unless the requests are identical.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.