All Products
Search
Document Center

DataWorks:CreateDataQualityRuleTemplate

Last Updated:Dec 05, 2024

Creates a data quality monitoring rule template.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
NamestringYes

The name of the template. The name can be up to 512 characters in length and can contain digits, letters, and punctuation marks.

ProjectIdlongYes

The DataWorks workspace ID.

12345
VisibleScopestringNo

The applicable scope of the template. Valid values:

  • Tenant: The template is available in all workspaces in the current tenant.
  • Project: The template is available only in the current workspace.
Project
DirectoryPathstringNo

The directory in which the template is stored. Slashes (/) are used to separate directory levels. The name of each directory level can be up to 1,024 characters in length. It cannot contain whitespace characters or slashes (/).

SamplingConfigobjectNo

The sampling settings.

MetricstringNo

The metrics used for sampling. 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 of the field after deduplication.
  • DistinctPercent: the proportion of the number of unique values of the field after deduplication to the number of rows in the table.
  • DuplicatedCount: the number of duplicated values of the field.
  • DuplicatedPercent: the proportion of the number of duplicated values of the field to the number of rows in the table.
  • TableSize: the table size.
  • NullValueCount: the number of rows in which the field value is null.
  • NullValuePercent: the proportion of the number of rows in which the field value is null to the number of rows in the table.
  • GroupCount: the field value and the number of rows for each field value.
  • CountNotIn: the number of rows in which the field values are different from the referenced values that you specified in the rule.
  • CountDistinctNotIn: the number of unique values that are different from the referenced values that you specified in the rule after deduplication.
  • UserDefinedSql: indicates that data is sampled by executing custom SQL statements.
Count
MetricParametersstringNo

The parameters required for sampling.

{"SQL": "select count(1) from table;"}
SettingConfigstringNo

The statements that are used to configure the parameters required for sampling before you execute the sampling statements. The statements can be up to 1,000 characters in length. Only the MaxCompute database is supported.

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

The check settings for sample data.

TypestringNo

The threshold calculation method. Valid values:

  • Fixed
  • Fluctation
  • FluctationDiscreate
  • Auto
  • Average
  • Variance
Fixed
ReferencedSamplesFilterstringNo

The method that is used to query the referenced samples. To obtain some types of thresholds, you need to query reference samples and perform aggregate operations on the reference values. In this example, an expression is used to specify the query method of referenced samples.

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

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The request ID.

691CA452-D37A-4ED0-9441

Examples

Sample success responses

JSONformat

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

Error codes

For a list of error codes, visit the Service error codes.