调用ListQualityRules根据分区表达式获取校验规则列表。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | ListQualityRules | 系统规定参数。取值:ListQualityRules。 |
ProjectName | String | 是 | autotest | 引擎或者数据源的名称。您可以从数据源配置中获取名称。 |
EntityId | Long | 是 | 1234 | 分区表达式的ID。您可以调用GetQualityEntity获取分区表达式ID。 |
PageNumber | Integer | 是 | 1 | 页码数。 |
PageSize | Integer | 是 | 20 | 每页显示的条数,默认为10条,最大为20条。 |
ProjectId | Long | 否 | 12345 | DataWorks项目空间ID |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
HttpStatusCode | Integer | 200 | HTTP返回码。 |
RequestId | String | 38cbdef0-f6cf-49**** | 请求ID,用于后续错误排查使用。 |
ErrorMessage | String | You have no permission. | 错误信息。 |
Success | Boolean | true | 调用是否成功,取值如下:
|
ErrorCode | String | Invalid.Tenant.ConnectionNotExists | 错误码。 |
Data | Object | 获取的规则列表。 |
|
PageNumber | Integer | 1 | 页码数。 |
PageSize | Integer | 20 | 每页显示的条数,默认为10条,最大为100条。 |
TotalCount | Long | 400 | 返回数据总量。 |
Rules | Array of Rules | 校验规则的详情。 |
|
BlockType | Integer | 0 | 校验规则的强弱。强弱表示规则的重要程度。取值如下:
|
OnDutyAccountName | String | test | 配置校验规则的阿里云账号名称。 |
Property | String | id | 字段的名称。 |
WarningThreshold | String | 10 | 橙色告警阈值。表示与样本预期的偏离程度,您可以根据业务需求自定义该阈值。 |
TableName | String | dual | 表的名称。 |
OnDuty | String | 1912**** | 配置校验规则的账号ID。 |
Comment | String | 校验表规则 | 规则的描述信息。 |
RuleCheckerRelationId | Integer | 132323 | 规则详情的内部关联ID。 |
FixCheck | Boolean | true | 固定值校验。 |
MethodId | Integer | 21 | 采集样本数据方法的ID。 |
TemplateName | String | sql任务表行数,1、7、30天波动检测 | 使用的校验模板的名称。 |
Trend | String | abs | 校验结果的趋势。 |
HistoryWarningThreshold | String | history max:40%,history min:10% | 历史橙色告警阈值。 |
RuleType | Integer | 0 | 规则的类型:
|
MatchExpression | String | dt=$[yyyymmdd] | 分区表达式。 |
ProjectName | String | autotest | 引擎或者数据源的名称。 |
PropertyKey | String | table_count | 用于数据质量前端规则联动,可以忽略。 |
CriticalThreshold | String | 40 | 红色告警阈值。表示与样本预期的偏离程度。您可以根据业务需求自定义该阈值。使用强规则并触发红色阈值,会阻塞调度任务。 |
HistoryCriticalThreshold | String | history max:80%,history min:50% | 历史红色告警阈值。 |
MethodName | String | count/table_count | 采集样本数据方法的名称。包括avg、count、sum、min、max、count_distinct、user_defined、table_count、table_size、table_dt_load_count、table_dt_refuseload_count、null_value、null_value/table_count、(table_count-count_distinct)/table_count、table_count-count_distinct等。 |
CheckerId | Integer | 7 | 校验器ID。 |
EntityId | Integer | 1234 | 分区表达式的ID。 |
ExpectValue | String | 1000 | 期望值。 |
TemplateId | Integer | 7 | 使用的校验模板的ID。 |
Id | Integer | 1234 | 规则的ID。 |
RuleName | String | test | 规则名称。 |
示例
请求示例
http(s)://[Endpoint]/?Action=ListQualityRules
&EntityId=1234
&PageNumber=1
&PageSize=20
&ProjectName=autotest
&RegionId=cn-shanghai
&<公共请求参数>
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<RequestId>38cbdef0-f6cf-49****</RequestId>
<HttpStatusCode>200</HttpStatusCode>
<Data>
<TotalCount>400</TotalCount>
<PageSize>20</PageSize>
<PageNumber>1</PageNumber>
<Rules>
<HistoryCriticalThreshold>history max:80%,history min:50%</HistoryCriticalThreshold>
<HistoryWarningThreshold>history max:40%,history min:10%</HistoryWarningThreshold>
<RuleCheckerRelationId>132323</RuleCheckerRelationId>
<ExpectValue>1000</ExpectValue>
<ProjectName>autotest</ProjectName>
<WarningThreshold>10</WarningThreshold>
<OnDuty>1912****</OnDuty>
<MatchExpression>dt=$[yyyymmdd]</MatchExpression>
<MethodId>21</MethodId>
<TemplateName>sql任务表行数,1、7、30天波动检测</TemplateName>
<MethodName>count/table_count</MethodName>
<Property>id</Property>
<RuleName>test</RuleName>
<TemplateId>7</TemplateId>
<Comment>校验表规则</Comment>
<CriticalThreshold>40</CriticalThreshold>
<Trend>abs</Trend>
<RuleType>0</RuleType>
<CheckerId>7</CheckerId>
<EntityId>1234</EntityId>
<TableName>dual</TableName>
<FixCheck>true</FixCheck>
<BlockType>0</BlockType>
<OnDutyAccountName>test</OnDutyAccountName>
<Id>1234</Id>
<PropertyKey>table_count</PropertyKey>
</Rules>
</Data>
<ErrorCode>Invalid.Tenant.ConnectionNotExists</ErrorCode>
<ErrorMessage>You have no permission.</ErrorMessage>
<Success>true</Success>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "38cbdef0-f6cf-49****",
"HttpStatusCode" : 200,
"Data" : {
"TotalCount" : 400,
"PageSize" : 20,
"PageNumber" : 1,
"Rules" : {
"HistoryCriticalThreshold" : "history max:80%,history min:50%",
"HistoryWarningThreshold" : "history max:40%,history min:10%",
"RuleCheckerRelationId" : 132323,
"ExpectValue" : 1000,
"ProjectName" : "autotest",
"WarningThreshold" : 10,
"OnDuty" : "1912****",
"MatchExpression" : "dt=$[yyyymmdd]",
"MethodId" : 21,
"TemplateName" : "sql任务表行数,1、7、30天波动检测",
"MethodName" : "count/table_count",
"Property" : "id",
"RuleName" : "test",
"TemplateId" : 7,
"Comment" : "校验表规则",
"CriticalThreshold" : 40,
"Trend" : "abs",
"RuleType" : 0,
"CheckerId" : 7,
"EntityId" : 1234,
"TableName" : "dual",
"FixCheck" : true,
"BlockType" : 0,
"OnDutyAccountName" : "test",
"Id" : 1234,
"PropertyKey" : "table_count"
}
},
"ErrorCode" : "Invalid.Tenant.ConnectionNotExists",
"ErrorMessage" : "You have no permission.",
"Success" : true
}
错误码
访问错误中心查看更多错误码。