GetDataQualityRule
Queries the details of a data quality rule.
This API has been deprecated. We recommend migrating to dataworks-public(2024-05-18) - GetDataQualityScan 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 a higher edition to use this feature.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dataworks:* |
get |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Id |
integer |
Yes |
The rule ID. |
19715 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response. |
||
| RequestId |
string |
The API request ID. |
691CA452-D37A-4ED0-**** |
| DataQualityRule |
object |
The rule details. |
|
| Id |
integer |
The rule ID. |
16033 |
| Name |
string |
The rule name. |
The table cannot be empty. |
| ProjectId |
integer |
The DataWorks workspace ID. |
1948 |
| Enabled |
boolean |
Indicates whether the rule is enabled. |
true |
| Severity |
string |
The severity level of the rule for business (corresponding to strong and weak rules on the page). Valid values:
|
High |
| Description |
string |
The rule description. The description can be up to 500 characters in length. |
this is a odps _sql task |
| Target |
object |
The object monitored by the rule. |
|
| Type |
string |
The monitored object type. Valid values:
|
Table |
| DatabaseType |
string |
The database type of the table for a table-type dataset. Valid values:
|
maxcompute |
| TableGuid |
string |
The unique ID of the table in Data Map that the rule applies to. |
odps.unit_test.tb_unit_test |
| PartitionSpec |
string |
The partition settings of the partitioned table. |
ds=$[yyyymmdd-1] |
| TemplateCode |
string |
The unique identifier of the rule template referenced by the rule. |
SYSTEM:table:table_count:fixed |
| SamplingConfig |
object |
The settings required for sample collection. |
|
| Metric |
string |
The name of the sampling metric. Valid values:
|
Max |
| MetricParameters |
string |
The parameters required for sample collection. |
{ "Columns": [ "id", "name" ] , "SQL": "select count(1) from table;"} |
| SettingConfig |
string |
The runtime parameter setting statements that are executed before the sampling statement. The value can be up to 1,000 characters in length. Only MaxCompute is supported. |
SET odps.sql.udf.timeout=600s; SET odps.sql.python.version=cp27; |
| SamplingFilter |
string |
The filter condition used to perform secondary filtering on irrelevant data during sampling. The value can be up to 16,777,215 characters in length. |
id IS NULL |
| CheckingConfig |
object |
The sample check settings. |
|
| Type |
string |
The threshold calculation method. Valid values:
|
Fixed |
| ReferencedSamplesFilter |
string |
Some types of thresholds require querying reference samples and then aggregating the values of the reference samples to derive the threshold for comparison. This field uses an expression to specify how to query the reference samples. |
{ "bizdate": [ "-1", "-7", "-1m" ] } |
| Thresholds |
object |
The threshold settings. |
|
| Expected |
object |
The expected threshold settings. |
|
| Operator |
string |
The comparison operator. Valid values:
|
> |
| Value |
string |
The threshold value. |
100.0 |
| Expression |
string |
The threshold expression. |
$checkValue <= 0.01 |
| Warned |
object |
The threshold settings for normal warnings. |
|
| Operator |
string |
The comparison operator. Valid values:
|
> |
| Value |
string |
The threshold value. |
100.0 |
| Expression |
string |
The threshold expression. |
$checkValue > 0.01 |
| Critical |
object |
The threshold settings for critical warnings. |
|
| Operator |
string |
The comparison operator. Valid values:
|
> |
| Value |
string |
The threshold value. |
100.0 |
| Expression |
string |
The threshold expression. |
$checkValue > 0.05 |
| ErrorHandlers |
array<object> |
The list of quality rule check error handlers. |
|
|
object |
The quality rule check error handler. |
||
| Type |
string |
The handler type. Valid values:
|
SaveErrorData |
| ErrorDataFilter |
string |
The SQL statement specified by the user to filter error data. This is required for custom SQL rules. |
SELECT * FROM tb_api_log WHERE id IS NULL |
Examples
Success response
JSON format
{
"RequestId": "691CA452-D37A-4ED0-****",
"DataQualityRule": {
"Id": 16033,
"Name": "The table cannot be empty.\n",
"ProjectId": 1948,
"Enabled": true,
"Severity": "High",
"Description": "this is a odps _sql task\n",
"Target": {
"Type": "Table",
"DatabaseType": "maxcompute",
"TableGuid": "odps.unit_test.tb_unit_test\n",
"PartitionSpec": "ds=$[yyyymmdd-1]\n"
},
"TemplateCode": "SYSTEM:table:table_count:fixed",
"SamplingConfig": {
"Metric": "Max",
"MetricParameters": "{ \"Columns\": [ \"id\", \"name\" ] , \"SQL\": \"select count(1) from table;\"}",
"SettingConfig": "SET odps.sql.udf.timeout=600s; \nSET odps.sql.python.version=cp27;\n",
"SamplingFilter": "id IS NULL\n"
},
"CheckingConfig": {
"Type": "Fixed",
"ReferencedSamplesFilter": "{ \"bizdate\": [ \"-1\", \"-7\", \"-1m\" ] }\n",
"Thresholds": {
"Expected": {
"Operator": ">",
"Value": "100.0",
"Expression": "$checkValue <= 0.01"
},
"Warned": {
"Operator": ">",
"Value": "100.0",
"Expression": "$checkValue > 0.01"
},
"Critical": {
"Operator": ">",
"Value": "100.0",
"Expression": "$checkValue > 0.05"
}
}
},
"ErrorHandlers": [
{
"Type": "SaveErrorData\n",
"ErrorDataFilter": "SELECT * FROM tb_api_log WHERE id IS NULL\n"
}
]
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.