GetDataQualityRuleTemplate

Updated at:

Queries the details of a data quality rule template.

Note

This API has been deprecated. We recommend migrating to dataworks-public(2024-05-18) - GetDataQualityTemplate 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 can call this operation only if you have purchased DataWorks Basic Edition or a more advanced edition.

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

Code

string

Yes

The code of the rule template.

USER_DEFINED:123

Response elements

Element

Type

Description

Example

object

The returned data.

RequestId

string

The request ID.

691CA452-D37A-4E****

DataQualityRuleTemplate

object

The details of the rule template.

Code

string

The code of the rule template.

USER_DEFINED:123

Name

string

The name of the rule template. The name can be a combination of digits, letters, Chinese characters, and half-width or full-width punctuation marks. The name can be a maximum of 512 characters in length.

Table row Count Verification

ProjectId

integer

The ID of the DataWorks workspace.

4020

SamplingConfig

object

The settings required for sample collection.

Metric

string

The name of the metric to be sampled:

  • Count: the number of rows in the table.

  • Min: the minimum value of the column.

  • Max: the maximum value of the column.

  • Avg: the average value of the column.

  • DistinctCount: the number of distinct values of the column.

  • DistinctPercent: the ratio of the number of distinct values of the column to the number of data rows.

  • DuplicatedCount: the number of duplicate values of the column.

  • DuplicatedPercent: the ratio of the number of duplicate values of the column to the number of data rows.

  • TableSize: the size of the table.

  • NullValueCount: the number of rows in which the column is null.

  • NullValuePercent: the percentage of rows in which the column is null.

  • GroupCount: the number of data rows corresponding to each value after aggregation by column value.

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

  • CountDistinctNotIn: the number of distinct values whose enumerated values do not match.

  • UserDefinedSql: collects samples by using a custom SQL statement.

Max

MetricParameters

string

The parameters required for sample collection.

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

SettingConfig

string

The runtime parameter setting statements that are inserted and executed before the specific sampling statement is executed. The setting can be a maximum of 1,000 characters in length. Only MaxCompute is supported.

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

CheckingConfig

object

The sample verification settings.

Type

string

The threshold calculation method:

  • Fixed

  • Fluctation

  • FluctationDiscreate

  • Auto

  • Average

  • Variance

Fixed

ReferencedSamplesFilter

string

Some types of thresholds require you to query reference samples and aggregate the values of the reference samples to obtain the threshold for comparison. An expression is used to indicate the query method of reference samples.

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

VisibleScope

string

The scope in which the template is available:

  • Tenant: available to the entire tenant.

  • Project: available only in the current project.

Project

DirectoryPath

string

The category directory in which the custom template is stored. Levels are separated by forward slashes (/). Each level name can be a maximum of 1,024 characters in length and cannot contain whitespace characters or forward slashes (/).

/ods/order_data

Examples

Success response

JSON format

{
  "RequestId": "691CA452-D37A-4E****",
  "DataQualityRuleTemplate": {
    "Code": "USER_DEFINED:123",
    "Name": "Table row Count Verification",
    "ProjectId": 4020,
    "SamplingConfig": {
      "Metric": "Max",
      "MetricParameters": "{\"SQL\": \"select count(1) from table;\"}",
      "SettingConfig": "SET odps.sql.udf.timeout=600s; \nSET odps.sql.python.version=cp27;\n"
    },
    "CheckingConfig": {
      "Type": "Fixed",
      "ReferencedSamplesFilter": "{ \"bizdate\": [ \"-1\", \"-7\", \"-1m\" ] }\n"
    },
    "VisibleScope": "Project",
    "DirectoryPath": "/ods/order_data"
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.