All Products
Search
Document Center

DataWorks:GetDataQualityRuleTemplate

Last Updated:Sep 03, 2026

Mengkueri detail templat aturan kualitas data.

Catatan

API ini telah ditinggalkan. Kami merekomendasikan migrasi ke dataworks-public(2024-05-18) - GetDataQualityTemplate guna memperoleh fungsionalitas yang lebih baik dan dukungan berkelanjutan. Meskipun API yang telah ditinggalkan ini masih dapat diakses sementara, tidak akan ada pembaruan atau perbaikan bug lebih lanjut.

Deskripsi operasi

You can call this operation only if you have purchased DataWorks Basic Edition or a more advanced edition.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tidak ada otorisasi untuk operasi ini. Jika Anda mengalami masalah saat menjalankan operasi ini, hubungi dukungan teknis.

Parameter permintaan

Parameter

Type

Required

Description

Example

Code

string

Yes

Kode templat aturan.

USER_DEFINED:123

Elemen respons

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

Max

MetricParameters

string

The parameters required for sampling.

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

SettingConfig

string

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;

CheckingConfig

object

The sample verification settings.

Type

string

The threshold calculation method. Valid values:

  • Fixed

  • Fluctation

  • FluctationDiscreate

  • Auto

  • Average

  • Variance

Fixed

ReferencedSamplesFilter

string

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 indicate the query method of referenced 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

Contoh

Respons sukses

JSONformat

{
  "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"
  }
}

Kode kesalahan

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.