文档

GetDIJob

更新时间:

调用GetDIJob接口,查看数据集成新版任务。当前支持的任务类型包括:MySQL到Hologres整库实时、MySQL到Hive整库离线同步任务。

调试

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

请求参数

名称

类型

是否必选

示例值

描述

Action String GetDIJob

系统规定参数。取值:GetDIJob

DIJobId Long 11588

任务ID。

WithDetails Boolean true

是否返回详细配置信息,详细配置信息包括TransformationRules、TableMappings、JobSettings。默认返回。

返回数据

名称

类型

示例值

描述

Data Object

任务信息。

ProjectId Long 22

工作空间的ID。

DIJobId Long 11588

任务ID。

JobName String mysql_to_holo_sync_445

任务名称。

Description String mysql同步到hologres

描述信息。

MigrationType String FullAndRealtimeIncremental

同步类型,可选的枚举值有:

  • FullAndRealtimeIncremental(全量和实时增量)
  • RealtimeIncremental(实时增量)
  • Full(全量)
  • OfflineIncremental(离线增量)
  • FullAndOfflineIncremental(全量+离线增量)
SourceDataSourceType String MySQL

源端数据源类型,枚举值:MySQL。

DestinationDataSourceType String Hologres

目标端数据源类型,枚举值:Hologres、Hive。

SourceDataSourceSettings Array of SourceDataSourceSetting

源端数据源设置,目前仅支持单个数据源。

DataSourceName String mysql_datasource_1

数据源名称。

DataSourceProperties Map

数据源属性。

String TimeZone

源端数据源属性。 MySQL数据源支持的属性名称包括:TimeZone(时区),Encoding(编码)。

DestinationDataSourceSettings Array of DestinationDataSourceSetting

目标端数据源设置,目前仅支持单个数据源。

DataSourceName String holo_datasource_1

数据源名称。

DataSourceProperties Map

数据源属性。

String TimeZone

目标端数据源属性。Hologres数据源暂无属性可设置。

ResourceSettings Object

资源设置。

OfflineResourceSettings Object

离线同步资源。

ResourceGroupIdentifier String S_res_group_111_222

离线同步使用的数据集成资源组标识。

RealtimeResourceSettings Object

实时同步资源。

ResourceGroupIdentifier String S_res_group_111_222

实时同步使用的数据集成资源组标识。

TransformationRules Array of TransformationRule

同步对象转换规则定义列表,列表中每个元素为一条转换规则定义。

RuleActionType String Rename

动作类型,可选的枚举值:

  • DefinePrimaryKey(定义主键)
  • Rename(重命名)
  • AddColumn(增加列)
  • HandleDml(DML处理)
  • DefineIncrementalCondition(定义增量条件)
  • DefineCycleScheduleSettings(定义周期调度设置)
  • DefineRuntimeSettings(定义高级配置参数)
  • DefinePartitionKey(定义分区列)
RuleExpression String {"expression":"${srcDatasoureName}_${srcDatabaseName}"}

规则表达式,json string格式。

重命名规则(Rename)示例: {"expression":"${srcDatasourceName}_${srcDatabaseName}_0922","variables":[{"variableName":"srcDatabaseName","variableRules":[{"from":"fromdb","to":"todb"}]}]}

expression:为重命名转换规则表达式,表达式内支持变量包括:${srcDatasourceName}(源端数据源名)、${srcDatabaseName}(源端库名)、${srcTableName}(源端表名)。

variables:为重命名转换规则表达式中各变量的生成规则,参数默认值为对应含义在源端的原始值,可按需定义一组字符串替换规则对原始值进行改写。variableName:变量名,不含${}。variableRules:变量生成规则组,按顺序串行执行替换,from原始字符串;to替换后字符串。

在目标端增加指定列并赋值规则(AddColumn)示例: {"columns":[{"columnName":"my_add_column","columnValueType":"Constant","columnValue":"123"}]}

如不指定,默认规则为不加列不复制。

columnName:附加的列名称。

columnValueType:附加的列取值类型,包括Constant(常量)、Variable(变量)。

columnValue:附加的列取值。当valueType=Constant时,value为自定义常量,String类型。当valueType=Variable时,value为内置变量。内置变量可选值包括:EXECUTE_TIME(执行时间,Long类型)、DB_NAME_SRC(源端数据库名称,String类型)、DATASOURCE_NAME_SRC(源端数据源名称,String类型)、TABLE_NAME_SRC(源端表名,String类型)、DB_NAME_DEST(目标端数据库名称,String类型)、DATASOURCE_NAME_DEST(目标端数据源名称,String类型)、TABLE_NAME_DEST(目标端表名,String类型)、DB_NAME_SRC_TRANSED(转换后的数据库名称,String类型)。

指定目标端表的主键列列名(DefinePrimaryKey)示例: {"columns":["ukcolumn1","ukcolumn2"]}

如不指定默认使用源端主键列。

当目标端为已有表:数据集成系统不会修改目标端表结构,如果指定的主键列不在目标端的列集合中,任务启动会报错提示。

当目标端为自动建表:数据集成系统会自动创建目标端表结构,表结构包含定义的主键列。当指定的主键列不在目标端的列集合中时,任务启动会报错提示。

DML处理规则(HandleDml)示例: {"dmlPolicies":[{"dmlType":"Delete","dmlAction":"Filter","filterCondition":"id > 1"}]}

如不指定,默认规则为Insert、Update、Delete均为Normal

dmlType:DML操作类型,Insert(插入)、Update(更新)、Delete(删除)

dmlAction:DML处理策略,Normal(正常处理)、Ignore(忽略)、Filter(有条件的正常处理,当dmlType=Update/Delete时使用)、LogicalDelete(逻辑删除)

filterCondition:DML过滤条件,当dmlAction=Filter时使用

RuleName String rename_rule_1

规则名称,当动作类型和动作作用的目标类型相同时,规则名称需保证唯一性。

RuleTargetType String Table

动作作用的目标类型,可选的数据类型有:

  • Table(表)
  • Schema(schema)
TableMappings Array of TableMapping

同步对象转换映射列表,列表中每个元素描述了一组源端同步对象选择规则列表和在该组同步对象上应用的同步对象转换规则列表。

SourceObjectSelectionRules Array of SourceObjectSelectionRule

源端对象选择规则,支持多条。

Expression String mysql_table_1

表达式。

ObjectType String Table

对象类型,可选的枚举值有:

  • Table(表)
  • Database(数据库)
TransformationRules Array of TransformationRule

源端对象上应用的转换规则列表。

RuleActionType String Rename

动作类型,可选的枚举值:

  • DefinePrimaryKey(定义主键)
  • Rename(重命名)
  • AddColumn(增加列)
  • HandleDml(DML处理)
  • DefineIncrementalCondition(定义增量条件)
  • DefineCycleScheduleSettings(定义周期调度设置)
  • DefineRuntimeSettings(定义高级配置参数)
  • DefinePartitionKey(定义分区列)
RuleName String rename_rule_1

规则名称,在一种动作类型+动作作用的目标类型下规则名称唯一。

RuleTargetType String Table

动作作用的目标类型,可选的枚举值有:

  • Table(表)
  • Schema(schema)
JobSettings Object

同步任务维度的设置,含DDL处理策略、源端和目标端列数据类型映射策略、任务运行时参数等。

ColumnDataTypeSettings Array of ColumnDataTypeSetting

列类型映射,支持多值。

SourceDataType String bigint

源端类型。

DestinationDataType String text

目标端类型。

DdlHandlingSettings Array of DdlHandlingSetting

DDL处理设置,支持多值。

Action String Critical

处理动作,可选的枚举值:

  • Ignore(忽略)
  • Critical(报错)
  • Normal(正常处理)
Type String AddColumn

DDL类型,可选的枚举值:

  • RenameColumn(重命名列)
  • ModifyColumn(更新列)
  • CreateTable(新建表)
  • TruncateTable(清空表)
  • DropTable(删除表)
  • DropColumn(删除列)
  • AddColumn(新增列)
RuntimeSettings Array of RuntimeSetting

运行时设置,支持多值。

Name String runtime.offline.concurrent

设置名称,可选的枚举值:

  • runtime.offline.speed.limit.mb(离线批量任务限流大小,当runtime.offline.speed.limit.enable=true时有效)
  • runtime.offline.speed.limit.enable(离线批量任务是否开启限流)
  • dst.offline.connection.max(离线批量任务写端最大连接数)
  • runtime.offline.concurrent(离线批量同步任务并发度)
  • dst.realtime.connection.max(实时任务写端最大连接数)
  • runtime.enable.auto.create.schema(是否自动在目标端创建schema)
  • src.offline.datasource.max.connection(离线批量任务源端最大连接数)
  • runtime.realtime.concurrent(实时任务并发度)
Value String 1

设置取值。

CycleScheduleSettings Object

周期调度设置。

CycleMigrationType String Full

需要周期调度的同步类型。取值范围:

  • Full:全量
  • OfflineIncremental:离线增量
ScheduleParameters String bizdate=$bizdate

调度参数。

ChannelSettings String {"structInfo":"MANAGED","storageType":"TEXTFILE","writeMode":"APPEND","partitionColumns":[{"columnName":"pt","columnType":"STRING","comment":""}],"fieldDelimiter":""}

通道相关任务设置,Json String形式。

CreatedTime Long 1671516776

创建时间戳,单位秒。

CreatedUid String 100000001

创建者用户ID。

UpdatedTime Long 1673859985

最近一次更新时间戳,单位秒。

UpdatedUid String 100000001

最近一次更新者用户ID。

StartedTime Long 1673859999

最近一次启动时间戳,单位秒。

StartedUid String 100000001

最近一次启动者用户ID。

JobStatus String Finished

同步状态,可选的枚举值:

  • Finished(运行成功已结束)
  • Initialized(初始化完成)
  • Stopped(已停止)
  • Failed(运行失败)
  • Running(运行中)
  • Stopping(停止中)
ErrorMessage String error details xxx

错误信息,当JobStatus=Failed时使用。

RunStats Map

运行统计信息

String StructureMigrationTotalTables

运行统计信息详情。

  • StructureMigrationTotalTables:结构同步表总数
  • StructureMigrationSuccessTables:结构同步表成功数
  • StructureMigrationFailedTables:结构同步表失败数
  • StructureMigrationStatus:结构同步状态,Waiting、Running、Finished、Failed、Stopped
  • StructureMigrationErrorMessage:结构同步错误信息
  • FullMigrationTotalTables:全量同步表总数
  • FullMigrationSuccessTables:全量同步表成功数
  • FullMigrationFailedTables:全量同步表失败数
  • FullMigrationStatus:全量同步状态
  • FullMigrationErrorMessage:全量同步错误信息
  • RealtimeMigrationMaxDelay:实时同步延迟时长,单位毫秒
  • RealtimeMigrationStatus:实时同步状态
  • RealtimeMigrationErrorMessage:实时已同步错误信息
RequestId String 0000-ABCD-EFG****

请求ID。

示例

请求示例

http(s)://[Endpoint]/?Action=GetDIJob
&DIJobId=11588
&WithDetails=true
&公共请求参数

正常返回示例

XML格式

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

<GetDIJobResponse>
    <Data>
        <ProjectId>22</ProjectId>
        <DIJobId>11588</DIJobId>
        <JobName>mysql_to_holo_sync_445</JobName>
        <Description>mysql同步到hologres</Description>
        <MigrationType>FullAndRealtimeIncremental</MigrationType>
        <SourceDataSourceType>MySQL</SourceDataSourceType>
        <DestinationDataSourceType>Hologres</DestinationDataSourceType>
        <SourceDataSourceSettings>
            <DataSourceName>mysql_datasource_1</DataSourceName>
            <DataSourceProperties>
                <key>TimeZone</key>
            </DataSourceProperties>
        </SourceDataSourceSettings>
        <DestinationDataSourceSettings>
            <DataSourceName>holo_datasource_1</DataSourceName>
            <DataSourceProperties>
                <key>TimeZone</key>
            </DataSourceProperties>
        </DestinationDataSourceSettings>
        <ResourceSettings>
            <OfflineResourceSettings>
                <ResourceGroupIdentifier>S_res_group_111_222</ResourceGroupIdentifier>
            </OfflineResourceSettings>
            <RealtimeResourceSettings>
                <ResourceGroupIdentifier>S_res_group_111_222</ResourceGroupIdentifier>
            </RealtimeResourceSettings>
        </ResourceSettings>
        <TransformationRules>
            <RuleActionType>Rename</RuleActionType>
            <RuleExpression>{"expression":"${srcDatasoureName}_${srcDatabaseName}"}</RuleExpression>
            <RuleName>rename_rule_1</RuleName>
            <RuleTargetType>Table</RuleTargetType>
        </TransformationRules>
        <TableMappings>
            <SourceObjectSelectionRules>
                <Expression>mysql_table_1</Expression>
                <ObjectType>Table</ObjectType>
            </SourceObjectSelectionRules>
            <TransformationRules>
                <RuleActionType>Rename</RuleActionType>
                <RuleName>rename_rule_1</RuleName>
                <RuleTargetType>Table</RuleTargetType>
            </TransformationRules>
        </TableMappings>
        <JobSettings>
            <ColumnDataTypeSettings>
                <SourceDataType>bigint</SourceDataType>
                <DestinationDataType>text</DestinationDataType>
            </ColumnDataTypeSettings>
            <DdlHandlingSettings>
                <Action>Critical</Action>
                <Type>AddColumn</Type>
            </DdlHandlingSettings>
            <RuntimeSettings>
                <Name>runtime.offline.concurrent</Name>
                <Value>1</Value>
            </RuntimeSettings>
        </JobSettings>
        <CreatedTime>1671516776</CreatedTime>
        <CreatedUid>100000001</CreatedUid>
        <UpdatedTime>1673859985</UpdatedTime>
        <UpdatedUid>100000001</UpdatedUid>
        <StartedTime>1673859999</StartedTime>
        <StartedUid>100000001</StartedUid>
        <JobStatus>Finished</JobStatus>
        <ErrorMessage>error details xxx</ErrorMessage>
        <RunStats>
            <key>StructureMigrationTotalTables</key>
        </RunStats>
    </Data>
    <RequestId>0000-ABCD-EFG****</RequestId>
</GetDIJobResponse>

JSON格式

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

{
  "Data" : {
    "ProjectId" : 22,
    "DIJobId" : 11588,
    "JobName" : "mysql_to_holo_sync_445",
    "Description" : "mysql同步到hologres",
    "MigrationType" : "FullAndRealtimeIncremental",
    "SourceDataSourceType" : "MySQL",
    "DestinationDataSourceType" : "Hologres",
    "SourceDataSourceSettings" : {
      "DataSourceName" : "mysql_datasource_1",
      "DataSourceProperties" : {
        "key" : "TimeZone"
      }
    },
    "DestinationDataSourceSettings" : {
      "DataSourceName" : "holo_datasource_1",
      "DataSourceProperties" : {
        "key" : "TimeZone"
      }
    },
    "ResourceSettings" : {
      "OfflineResourceSettings" : {
        "ResourceGroupIdentifier" : "S_res_group_111_222"
      },
      "RealtimeResourceSettings" : {
        "ResourceGroupIdentifier" : "S_res_group_111_222"
      }
    },
    "TransformationRules" : {
      "RuleActionType" : "Rename",
      "RuleExpression" : "{\"expression\":\"${srcDatasoureName}_${srcDatabaseName}\"}",
      "RuleName" : "rename_rule_1",
      "RuleTargetType" : "Table"
    },
    "TableMappings" : {
      "SourceObjectSelectionRules" : {
        "Expression" : "mysql_table_1",
        "ObjectType" : "Table"
      },
      "TransformationRules" : {
        "RuleActionType" : "Rename",
        "RuleName" : "rename_rule_1",
        "RuleTargetType" : "Table"
      }
    },
    "JobSettings" : {
      "ColumnDataTypeSettings" : {
        "SourceDataType" : "bigint",
        "DestinationDataType" : "text"
      },
      "DdlHandlingSettings" : {
        "Action" : "Critical",
        "Type" : "AddColumn"
      },
      "RuntimeSettings" : {
        "Name" : "runtime.offline.concurrent",
        "Value" : 1
      }
    },
    "CreatedTime" : 1671516776,
    "CreatedUid" : 100000001,
    "UpdatedTime" : 1673859985,
    "UpdatedUid" : 100000001,
    "StartedTime" : 1673859999,
    "StartedUid" : 100000001,
    "JobStatus" : "Finished",
    "ErrorMessage" : "error details xxx",
    "RunStats" : {
      "key" : "StructureMigrationTotalTables"
    }
  },
  "RequestId" : "0000-ABCD-EFG****"
}

错误码

HttpCode

错误码

错误信息

描述

429 Throttling.Api The request for this resource has exceeded your available limit. 对该资源的请求已超过您的可用上限。
429 Throttling.System The DataWorks system is busy. Try again later. DataWorks系统繁忙,请稍后再试。
429 Throttling.User Your request is too frequent. Try again later. 您的请求过于频繁,请尝试放缓请求速度。
500 InternalError.System An internal system error occurred. Try again later. 系统内部错误,请稍后再试。
500 InternalError.UserId.Missing An internal system error occurred. Try again later. 系统内部错误,请稍后再试。

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

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