全部产品
Search
文档中心

大数据开发治理平台 DataWorks:ListQualityRules

更新时间:Oct 12, 2023

调用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

调用是否成功,取值如下:

  • true:调用成功。
  • false:调用失败。
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

校验规则的强弱。强弱表示规则的重要程度。取值如下:

  • 1,表示强规则。
  • 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

规则的类型:

  • 0表示系统创建。
  • 1表示用户创建。
  • 2表示项目级规则。
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
&ProjectName=autotest
&EntityId=1234
&PageNumber=1
&PageSize=20
&ProjectId=12345
&公共请求参数

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

<ListQualityRulesResponse>
    <HttpStatusCode>200</HttpStatusCode>
    <RequestId>38cbdef0-f6cf-49****</RequestId>
    <ErrorMessage>You have no permission.</ErrorMessage>
    <Success>true</Success>
    <ErrorCode>Invalid.Tenant.ConnectionNotExists</ErrorCode>
    <Data>
        <PageNumber>1</PageNumber>
        <PageSize>20</PageSize>
        <TotalCount>400</TotalCount>
        <Rules>
            <BlockType>0</BlockType>
            <OnDutyAccountName>test</OnDutyAccountName>
            <Property>id</Property>
            <WarningThreshold>10</WarningThreshold>
            <TableName>dual</TableName>
            <OnDuty>1912****</OnDuty>
            <Comment>校验表规则</Comment>
            <RuleCheckerRelationId>132323</RuleCheckerRelationId>
            <FixCheck>true</FixCheck>
            <MethodId>21</MethodId>
            <TemplateName>sql任务表行数,1、7、30天波动检测</TemplateName>
            <Trend>abs</Trend>
            <HistoryWarningThreshold>history max:40%,history min:10%</HistoryWarningThreshold>
            <RuleType>0</RuleType>
            <MatchExpression>dt=$[yyyymmdd]</MatchExpression>
            <ProjectName>autotest</ProjectName>
            <PropertyKey>table_count</PropertyKey>
            <CriticalThreshold>40</CriticalThreshold>
            <HistoryCriticalThreshold>history max:80%,history min:50%</HistoryCriticalThreshold>
            <MethodName>count/table_count</MethodName>
            <CheckerId>7</CheckerId>
            <EntityId>1234</EntityId>
            <ExpectValue>1000</ExpectValue>
            <TemplateId>7</TemplateId>
            <Id>1234</Id>
            <RuleName>test</RuleName>
        </Rules>
    </Data>
</ListQualityRulesResponse>

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "HttpStatusCode" : 200,
  "RequestId" : "38cbdef0-f6cf-49****",
  "ErrorMessage" : "You have no permission.",
  "Success" : true,
  "ErrorCode" : "Invalid.Tenant.ConnectionNotExists",
  "Data" : {
    "PageNumber" : 1,
    "PageSize" : 20,
    "TotalCount" : 400,
    "Rules" : {
      "BlockType" : 0,
      "OnDutyAccountName" : "test",
      "Property" : "id",
      "WarningThreshold" : 10,
      "TableName" : "dual",
      "OnDuty" : "1912****",
      "Comment" : "校验表规则",
      "RuleCheckerRelationId" : 132323,
      "FixCheck" : true,
      "MethodId" : 21,
      "TemplateName" : "sql任务表行数,1、7、30天波动检测",
      "Trend" : "abs",
      "HistoryWarningThreshold" : "history max:40%,history min:10%",
      "RuleType" : 0,
      "MatchExpression" : "dt=$[yyyymmdd]",
      "ProjectName" : "autotest",
      "PropertyKey" : "table_count",
      "CriticalThreshold" : 40,
      "HistoryCriticalThreshold" : "history max:80%,history min:50%",
      "MethodName" : "count/table_count",
      "CheckerId" : 7,
      "EntityId" : 1234,
      "ExpectValue" : 1000,
      "TemplateId" : 7,
      "Id" : 1234,
      "RuleName" : "test"
    }
  }
}

错误码

访问错误中心查看更多错误码。