文档

ListQualityResultsByRule

更新时间:

根据校验规则校验数据源的质量,并查询校验结果。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称

类型

是否必选

示例值

描述

Action String ListQualityResultsByRule

要执行的操作。

RuleId Long 152322134

使用的校验规则ID。您可以使用该规则ID与分区表达式等信息进行联合查询。

StartDate String 2020-09-20 00:00:00

业务日期起始时间,格式为yyyy-MM-dd HH:mm:ss。

该参数与EndDate配合使用,二者所取的时间区间不能大于7天。

EndDate String 2020-09-22 00:00:00

业务日期截止时间,格式为yyyy-MM-dd HH:mm:ss。

该参数与StartDate配合使用,二者所取的时间区间不能大于7天。

PageSize Integer 10

每页显示的条数,默认为10条,最大100条。

PageNumber Integer 1

页码数。

ProjectName String autotest

需要进行数据质量校验的引擎或者数据源名称。

ProjectId Long 12345

DataWorks项目空间ID。

返回数据

名称

类型

示例值

描述

HttpStatusCode Integer 200

HTTP状态码。

ErrorMessage String You have no permission.

错误信息。

RequestId String CBA58543-00D4-41****

请求ID。

ErrorCode String 401

错误码。

Success Boolean true

请求是否成功。

Data Object

校验结果的顶层结构体。

PageNumber Integer 1

页码数。

PageSize Integer 10

每页显示的条数,默认为10条,最大100条。

TotalCount Long 200

数据的总记录数。

RuleChecks Array of RuleChecks

校验结果的列表。

BlockType Integer 1

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

  • 1,表示强规则。
  • 0,表示弱规则。

    您可以根据实际需求设置重要的规则为强规则。如果使用强规则并触发了红色告警,则会阻塞调度任务。

WarningThreshold Float 0.1

橙色阈值。表示与样本预期的偏离程度,您可以根据业务需求自定义该阈值。

Property String type

规则属性的字段,即被校验数据源表的column名称。

TableName String dual

进行校验的表名称。

Comment String 规则的描述信息。

校验规则的描述。

CheckResultStatus Integer 2

校验结果状态。

TemplateName String 字段唯一值个数期望值校验

使用的校验模板的名称。

CheckerName String fulx

校验器的名称。

RuleId Long 123421

规则ID。

FixedCheck Boolean false

是否为固定值校验。取值如下:

  • true:是固定值校验。
  • false:非固定值校验。
Op String >

比较符。

UpperValue Float 22200

预测上限。设置阈值后自动生成。

ActualExpression String ds=20200925

被校验的数据源表的实际分区。

ExternalId String 123112232

调度任务的节点ID。

TimeCost String 10

执行校验任务花费的时间。

Trend String up

校验结果的趋势。

ExternalType String CWF2

调度系统的类型。目前仅支持CWF。

BizDate Long 1600704000000

业务日期。如果被校验的业务主体为离线数据,则业务日期通常为执行校验操作的前一天。

CheckResult Integer 2

校验结果。

ResultString String ResultString

校验结果的字符串形式。

MatchExpression String ds=$[yyyymmdd]

分区表达式。

CheckerType Integer 0

校验器的类型。

ProjectName String autotest

需要进行数据质量校验的引擎或者数据源名称。

BeginTime Long 1600704000000

执行校验操作的开始时间。

DateType String YMD

调度周期的类型。通常为YMD,即年任务、月任务、天任务。

CriticalThreshold Float 0.6

红色阈值。表示与样本预期的偏离程度。您可以根据业务需求自定义该阈值。使用强规则并触发红色阈值,会阻塞调度任务。

IsPrediction Boolean false

是否为预测的结果。取值如下:

  • true:是预测的结果。
  • false:不是预测的结果。
RuleName String 规则的名称。

规则的名称。

CheckerId Integer 7

校验器的ID。

DiscreteCheck Boolean true

是否为离散校验。取值如下:

  • true:是离散校验。
  • false:非离散校验。
EndTime Long 1600704000000

查询校验结果的截止时间。

MethodName String max

采集样本数据的方法。包括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等。

LowerValue Float 2344

预测下限。根据您设置的阈值自动生成。

EntityId Long 14534343

分区表达式ID。

WhereCondition String type!='type2'

校验任务使用的过滤条件。

ExpectValue Float 90

期望值。

TemplateId Integer 5

使用的校验模板的ID。

TaskId String 16008552981681a0d6****

校验任务的ID。

Id Long 2231123

主键ID。

ReferenceValue Array of ReferenceValue

历史样本值。

DiscreteProperty String type1

通过group by分组后的样本字段取值。例如group by性别字段,则DiscreteProperty为男生、女生和null。

Value Float 20

样本值。

BizDate String 1600704000000

业务日期。如果被校验的业务主体为离线数据,则业务日期通常为执行校验操作的前一天。

SingleCheckResult Integer 2

校验结果的字符串。

Threshold Float 0.2

阈值。

SampleValue Array of SampleValue

当前使用的样本。

DiscreteProperty String type2

通过group by分组后的样本字段取值。例如group by性别字段,则DiscreteProperty为男生、女生和null。

BizDate String 1600704000000

业务日期。如果被校验的业务主体为离线数据,则业务日期通常为执行校验操作的前一天。

Value Float 23

样本值。

Open Boolean true

规则是否开启。

示例

请求示例

http(s)://[Endpoint]/?Action=ListQualityResultsByRule
&EndDate=2020-09-22 00:00:00
&PageNumber=1
&PageSize=10
&ProjectName=autotest
&RuleId=152322134
&StartDate=2020-09-20 00:00:00
&<公共请求参数>

正常返回示例

XML格式

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

<ListQualityResultsByRuleResponse>
    <RequestId>CBA58543-00D4-41****</RequestId>
    <QualityResults>
        <TotalCount>200</TotalCount>
        <PageSize>10</PageSize>
        <PageNumber>1</PageNumber>
        <RuleChecks>
            <Op>&amp;gt;</Op>
            <TaskId>16008552981681a0d6****</TaskId>
            <EndTime>1600704000000</EndTime>
            <DiscreteCheck>true</DiscreteCheck>
            <CheckerName>fulx</CheckerName>
            <ExpectValue>90</ExpectValue>
            <ProjectName>autotest</ProjectName>
            <RuleId>123421</RuleId>
            <WarningThreshold>0.1</WarningThreshold>
            <WhereCondition>type!='type2'</WhereCondition>
            <BeginTime>1600704000000</BeginTime>
            <CheckResultStatus>2</CheckResultStatus>
            <MatchExpression>ds=$[yyyymmdd]</MatchExpression>
            <UpperValue>22200</UpperValue>
            <IsPrediction>false</IsPrediction>
            <CheckResult>2</CheckResult>
            <TemplateName>字段唯一值个数期望值校验</TemplateName>
            <TimeCost>10</TimeCost>
            <FixedCheck>false</FixedCheck>
            <MethodName>max</MethodName>
            <ResultString>ResultString</ResultString>
            <Property>type</Property>
            <DateType>YMD</DateType>
            <BizDate>1600704000000</BizDate>
            <TemplateId>5</TemplateId>
            <RuleName>这里是规则名称</RuleName>
            <Comment>这里是规则描述信息</Comment>
            <CriticalThreshold>0.6</CriticalThreshold>
            <ExternalId>123112232</ExternalId>
            <Trend>up</Trend>
            <CheckerType>0</CheckerType>
            <ExternalType>CWF2</ExternalType>
            <CheckerId>7</CheckerId>
            <EntityId>14534343</EntityId>
            <TableName>dual</TableName>
            <BlockType>1</BlockType>
            <Id>2231123</Id>
            <ActualExpression>ds=20200925</ActualExpression>
            <LowerValue>2344</LowerValue>
        </RuleChecks>
        <RuleChecks>
            <SampleValue>
                <SingleCheckResult>2</SingleCheckResult>
                <Value>20</Value>
                <BizDate>1600704000000</BizDate>
                <DiscreteProperty>type1</DiscreteProperty>
                <Threshold>0.2</Threshold>
            </SampleValue>
            <SampleValue>
                <Value>23</Value>
                <BizDate>1600704000000</BizDate>
                <DiscreteProperty>type2</DiscreteProperty>
            </SampleValue>
            <ReferenceValue>
                <SingleCheckResult>2</SingleCheckResult>
                <Value>20</Value>
                <BizDate>1600704000000</BizDate>
                <DiscreteProperty>type1</DiscreteProperty>
                <Threshold>0.2</Threshold>
            </ReferenceValue>
            <ReferenceValue>
                <Value>23</Value>
                <BizDate>1600704000000</BizDate>
                <DiscreteProperty>type2</DiscreteProperty>
            </ReferenceValue>
        </RuleChecks>
    </QualityResults>
</ListQualityResultsByRuleResponse>

JSON格式

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

{
  "RequestId" : "CBA58543-00D4-41****",
  "QualityResults" : {
    "TotalCount" : 200,
    "PageSize" : 10,
    "PageNumber" : 1,
    "RuleChecks" : [ {
      "Op" : "&amp;gt;",
      "TaskId" : "16008552981681a0d6****",
      "EndTime" : 1600704000000,
      "DiscreteCheck" : true,
      "CheckerName" : "fulx",
      "ExpectValue" : 90,
      "ProjectName" : "autotest",
      "RuleId" : 123421,
      "WarningThreshold" : 0.1,
      "WhereCondition" : "type!='type2'",
      "BeginTime" : 1600704000000,
      "CheckResultStatus" : 2,
      "MatchExpression" : "ds=$[yyyymmdd]",
      "UpperValue" : 22200,
      "IsPrediction" : false,
      "CheckResult" : 2,
      "TemplateName" : "字段唯一值个数期望值校验",
      "TimeCost" : 10,
      "FixedCheck" : false,
      "MethodName" : "max",
      "ResultString" : "ResultString",
      "Property" : "type",
      "DateType" : "YMD",
      "BizDate" : 1600704000000,
      "TemplateId" : 5,
      "RuleName" : "这里是规则名称",
      "Comment" : "这里是规则描述信息",
      "CriticalThreshold" : 0.6,
      "ExternalId" : 123112232,
      "Trend" : "up",
      "CheckerType" : 0,
      "ExternalType" : "CWF2",
      "CheckerId" : 7,
      "EntityId" : 14534343,
      "TableName" : "dual",
      "BlockType" : 1,
      "Id" : 2231123,
      "ActualExpression" : "ds=20200925",
      "LowerValue" : 2344
    }, {
      "SampleValue" : [ {
        "SingleCheckResult" : 2,
        "Value" : 20,
        "BizDate" : 1600704000000,
        "DiscreteProperty" : "type1",
        "Threshold" : 0.2
      }, {
        "Value" : 23,
        "BizDate" : 1600704000000,
        "DiscreteProperty" : "type2"
      } ],
      "ReferenceValue" : [ {
        "SingleCheckResult" : 2,
        "Value" : 20,
        "BizDate" : 1600704000000,
        "DiscreteProperty" : "type1",
        "Threshold" : 0.2
      }, {
        "Value" : 23,
        "BizDate" : 1600704000000,
        "DiscreteProperty" : "type2"
      } ]
    } ]
  }
}

错误码

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

  • 本页导读 (1)
文档反馈