CreateQualityRule

Updated at:

Creates a quality monitoring rule.

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.

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

BlockType

integer

Yes

The strength of the rule. Valid values:

  • 0: weak rule

  • 1: strong rule

0

EntityId

integer

Yes

The ID of the partition expression.

15224

Comment

string

No

The description of the rule.

Verification

Checker

integer

No

The ID of the checker. Valid values:

  • 2: 7-day average fluctuation

  • 3: 30-day average fluctuation

  • 4: 1-day cycle comparison

  • 5: 7-day cycle comparison

  • 6: 30-day cycle comparison

  • 7: 7-day variance fluctuation

  • 8: 30-day variance fluctuation

  • 9: comparison with a fixed value

  • 10: 1-day, 7-day, and 30-day fluctuation detection

  • 11: previous cycle comparison

9

ExpectValue

string

No

The expected value.

0

Trend

string

No

The trend of the check result. Valid values:

  • up: upward trend

  • down: downward trend

  • abs: absolute value

abs

MethodName

string

No

The sampling method. If custom SQL is used, the value of this parameter is user_defined.

count/table_count

Operator

string

No

The comparison operator. Valid values include >, >=, =, ≠, <, and <=.

Note

When Checker is set to 9, Operator is required.

>

ProjectName

string

Yes

The name of the engine or data source.

autotest

Property

string

No

The field to which the rule applies. For table-level checks, the fields are table_count for the number of rows and table_size for the table size.

table_id

PropertyType

string

No

The type of the field. Set this parameter to table for table-level fields, or specify a data type such as bigint for column-level fields.

bigint

RuleType

integer

Yes

The type of the rule. Valid values:

  • 0: system template rule

  • 1: custom SQL rule

  • 4: custom template rule

0

WhereCondition

string

No

The filter condition or custom SQL statement.

table_id>1

CriticalThreshold

string

No

The threshold for a critical alert, which indicates the degree of deviation from the expected sample value. You can customize this threshold based on your business requirements. If a strong rule is used and the critical threshold is triggered, the scheduling task is blocked.

20

WarningThreshold

string

No

The threshold for a warning alert, which indicates the degree of deviation from the expected sample value. You can customize this threshold based on your business requirements.

10

TemplateId

integer

No

The ID of the template.

7

RuleName

string

Yes

The name of the rule.

1234

PredictType

integer

Yes

Specifies whether the threshold is dynamic. Valid values:

  • 0: non-dynamic threshold

  • 2: dynamic threshold

0

ProjectId

integer

No

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

TaskSetting

string

No

The variable settings inserted before the custom rule. Format: x=a,y=b.

x=a,y=b

Response elements

Element

Type

Description

Example

object

The response parameters.

HttpStatusCode

integer

The HTTP status code.

200

Data

string

The ID of the created rule.

12345

ErrorMessage

string

The error message.

You have no permission.

RequestId

string

The request ID.

ecb967ec-c137-48****

ErrorCode

string

The error code.

401

Success

boolean

Indicates whether the call was successful.

true

Examples

Success response

JSON format

{
  "HttpStatusCode": 200,
  "Data": "12345",
  "ErrorMessage": "You have no permission.",
  "RequestId": "ecb967ec-c137-48****",
  "ErrorCode": "401",
  "Success": true
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.