全部產品
Search
文件中心

DataWorks:UpdateDIJob - 更新Data Integration同步任務

更新時間:Apr 07, 2026

更新Data Integration任務。

介面說明

需要購買 DataWorks 基礎版及以上版本才能使用。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

當前API暫無授權資訊透出。

請求參數

名稱

類型

必填

描述

樣本值

Id

integer

任務 ID。

11588

Description

string

任務的描述

DI Job Demo

TableMappings

array<object>

同步對象轉換映射列表,列表中每個元素描述了一組源端同步對象選擇規則列表和在該組同步對象上應用的同步對象轉換規則列表

說明

[ { "SourceObjectSelectionRules":[ { "ObjectType":"Database", "Action":"Include", "ExpressionType":"Exact", "Expression":"biz_db" }, { "ObjectType":"Schema", "Action":"Include", "ExpressionType":"Exact", "Expression":"s1" }, { "ObjectType":"Table", "Action":"Include", "ExpressionType":"Exact", "Expression":"table1" } ], "TransformationRuleNames":[ { "RuleName":"my_database_rename_rule", "RuleActionType":"Rename", "RuleTargetType":"Schema" } ] } ]

array<object>

同步對象轉換映射列表,列表中每個元素描述了一組源端同步對象選擇規則列表和在該組同步對象上應用的同步對象轉換規則列表

SourceObjectSelectionRules

array<object>

每條規則可選擇待同步源端對象的不同物件類型,如選擇源端資料庫、源端資料表

object

每條規則可選擇待同步源端對象的不同物件類型,如選擇源端資料庫、源端資料表

Action

string

選擇動作,取值範圍:Include/Exclude

Include

Expression

string

運算式

mysql_table_1

ExpressionType

string

運算式類型,取值範圍:Exact/Regex

Exact

ObjectType

string

物件類型,可選的枚舉值:

  • Table(表)

  • Schema(schema)

  • Database(資料庫)

Table

TransformationRules

array<object>

源端對象上應用的轉換規則

object

源端對象上應用的轉換規則

RuleName

string

規則名稱,在一種動作類型+動作作用的目標類型下規則名稱唯一,長度不能超過 50 個字元

rename_rule_1

RuleActionType

string

動作類型,可選的枚舉值:

  • DefinePrimaryKey(定義主鍵)

  • Rename(重新命名)

  • AddColumn(增加列)

  • HandleDml(DML 處理)

Rename

RuleTargetType

string

動作作用的目標類型,可選的枚舉值:

  • Table(表)

  • Schema(schema)

  • Database(資料庫)

Table

JobSettings

object

同步任務維度設定,含 DDL 處理策略、源端和目標端列資料類型映射策略、任務運行時參數等

ChannelSettings

string

通道相關任務設定,可以對一些特定通道進行特殊配置,目前支援 Holo2Holo(從 holo 同步到 holo),Holo2Kafka(從 Holo 同步到 Kafka)

  1. Holo2Kafka

  • 樣本:{"destinationChannelSettings":{"kafkaClientProperties":[{"key":"linger.ms","value":"100"}],"keyColumns":["col3"],"writeMode":"canal"}} kafkaClientProperties:kafka producer 參數,寫入 kafka 時使用

  • keyColumns, 需要寫入的 kafka 列取值

  • writeMode,kafka 寫入格式,目前支援 json/canal

  1. Holo2Holo

  • 樣本: {"destinationChannelSettings":{"conflictMode":"replace","dynamicColumnAction":"replay","writeMode":"replay"}}

  • conflictMode: 寫入 holo 衝突處理策略,replace-覆蓋、ignore-忽略

  • writeMode: 寫入 holo 方式,replay-重放、insert-插入

  • dynamicColumnAction:寫入 holo 動態列方式 replay-重放、insert-插入,ignore-忽略

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

ColumnDataTypeSettings

array<object>

列類型映射數組

說明

["ColumnDataTypeSettings":[ { "SourceDataType":"Bigint", "DestinationDataType":"Text" } ]

object

單條列類型映射

DestinationDataType

string

目標端類型。如 bigint,boolean,string,text,datetime,timestamp,decimal,binary,不同資料來源類型會有類型差異

text

SourceDataType

string

源端類型。如 bigint,boolean,string,text,datetime,timestamp,decimal,binary,不同資料來源類型會有類型差異

bigint

CycleScheduleSettings

object

周期調度設定

ScheduleParameters

string

調度參數

bizdate=$bizdate

DdlHandlingSettings

array<object>

DDL 處理設定數組。

說明

["DDLHandlingSettings":[ { "Type":"Insert", "Action":"Normal" } ]

object

單條 DDL 處理設定

Action

string

處理動作,可選的枚舉值:

  • Ignore(忽略)

  • Critical(報錯)

  • Normal(正常處理)

Critical

Type

string

DDL 類型,可選的枚舉值:

  • RenameColumn(重新命名列)

  • ModifyColumn(更新列)

  • CreateTable(建立表)

  • TruncateTable(清空表)

  • DropTable(刪除表)

  • DropColumn(刪除列)

  • AddColumn(新增列)

AddColumn

RuntimeSettings

array<object>

運行時設定

object

運行時設定

Name

string

設定名稱,可選的枚舉值:

  • src.offline.datasource.max.connection(離線批量任務源端最大串連數)

  • dst.offline.truncate (是否清空目標表)

  • runtime.offline.speed.limit.enable(離線批量任務是否開啟限流)

  • runtime.offline.concurrent(離線批量同步任務並發度)

  • runtime.enable.auto.create.schema(是否自動在目標端建立 schema)

  • runtime.realtime.concurrent(即時任務並發度)

  • runtime.realtime.failover.minute.dataxcdc (failover 失敗重啟等待時間單位分鐘)

  • runtime.realtime.failover.times.dataxcdc (failover 失敗重啟次數)

src.offline.datasource.max.connection

Value

string

設定取值

1

ResourceSettings

object

資源設定

OfflineResourceSettings

object

離線同步資源

RequestedCu

number

離線同步使用的Data Integration資源群組 cu

2

ResourceGroupIdentifier

string

離線同步使用的Data Integration資源群組名稱

S_res_group_111_222

RealtimeResourceSettings

object

即時同步資源

RequestedCu

number

即時同步使用的Data Integration資源群組 cu

2

ResourceGroupIdentifier

string

即時同步使用的Data Integration資源群組名稱

S_res_group_111_222

ScheduleResourceSettings

object

調度資源

RequestedCu

number

離線同步任務使用的調度資源群組 cu

2

ResourceGroupIdentifier

string

離線同步任務使用的調度資源群組名稱

S_res_group_222_333

TransformationRules

array<object>

同步對象轉換規則定義列表

說明

[ { "RuleName":"my_database_rename_rule", "RuleActionType":"Rename", "RuleTargetType":"Schema", "RuleExpression":"{"expression":"${srcDatasoureName}_${srcDatabaseName}"}" } ]

object

單個同步對象轉換規則定義,每個元素為一條轉換規則定義

RuleActionType

string

動作類型,可選的枚舉值:

  • DefinePrimaryKey(定義主鍵)

  • Rename(重新命名)

  • AddColumn(增加列)

  • HandleDml(DML 處理)

  • DefineIncrementalCondition(定義增量條件)

  • DefineCycleScheduleSettings(定義周期調度設定)

  • DefinePartitionKey(定義分區列)

Rename

RuleExpression

string

規則運算式,json string 格式。

  1. 重新命名規則(Rename)

  • 樣本:{"expression":"${srcDatasourceName}_${srcDatabaseName}_0922" }

  • expression:為重新命名轉換規則運算式,運算式內支援變數包括:${srcDatasourceName}(源端資料來源名)、${srcDatabaseName}(源端庫名)、${srcTableName}(源端表名)。

  1. 加列規則(AddColumn)

  • 樣本:{"columns":[{"columnName":"my_add_column","columnValueType":"Constant","columnValue":"123"}]}

  • 如不指定,預設規則為不加列不複製。

  • columnName:附加的列名稱。

  • columnValueType:附加的列取實值型別,包括 Constant(常量)、Variable(變數)。

  • columnValue:附加的列取值。當 columnValueType=Constant 時,value 為自訂常量,String 類型。當 columnValueType=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 類型)。

  1. 指定目標端表的主鍵列列名(DefinePrimaryKey)

  • 樣本:{"columns":["ukcolumn1","ukcolumn2"]}

  • 如不指定預設使用源端主鍵列。

  • 當目標端為已有表:Data Integration系統不會修改目標端表結構,如果指定的主鍵列不在目標端的列集合中,任務啟動會報錯提示。

  • 當目標端為自動建表:Data Integration系統會自動建立目標端表結構,表結構包含定義的主鍵列。當指定的主鍵列不在目標端的列集合中時,任務啟動會報錯提示。

  1. 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 時使用

  1. 增量條件(DefineIncrementalCondition)

  • 樣本: {"where":"id > 0"}

  • 指定增量過濾條件

  1. 周期調度參數(DefineCycleScheduleSettings)

  • 樣本: {"cronExpress":" * * * * * *", "cycleType":"1"}

  • 指定周期任務調度參數

  1. 指定分區鍵(DefinePartitionKey)

  • 樣本: {"columns":["id"]}

  • 指定分區鍵

{"expression":"${srcDatasoureName}_${srcDatabaseName}"}

RuleName

string

規則名稱,當動作類型和動作作用的目標類型相同時,規則名稱需保證唯一性,長度不能超過 50 個字元

rename_rule_1

RuleTargetType

string

動作作用的目標類型,可選的枚舉值:

  • Table(表)

  • Schema(schema)

  • Database(資料庫)

Table

ProjectId

integer

DataWorks 工作空間 ID。您可以通過 ListProjects 介面擷取工作空間 ID。

10000

DIJobId deprecated

integer

該欄位已廢棄,請使用 Id 欄位。

11588

Owner

string

任務責任人

95279527

FileSpec

string

指令碼模式代碼內容

{ "resourceSettings": { "realtimeResourceSettings": { "requestedCu": 2, "resourceGroupIdentifier": "Serverless_res_group_123_456" }, "offlineResourceSettings": { "requestedCu": 2, "resourceGroupIdentifier": "Serverless_res_group_123_456" } }, "tableMappings": [ { "sourceObjectSelectionRules": [ { "expression": "autotest_hologres", "action": "Include", "expressionType": "Exact", "objectType": "Datasource" }, { "expression": "auto_holo_2661647", "action": "Include", "expressionType": "Exact", "objectType": "Table" }, { "expression": "public", "action": "Include", "expressionType": "Exact", "objectType": "Schema" } ], "transformationRules": [ { "ruleTargetType": "Table", "ruleActionType": "SourceSchema", "ruleName": "SourceSchema_Table_BStf8aXPSCJjOWGe" }, { "ruleTargetType": "Schema", "ruleActionType": "Rename", "ruleName": "Rename_Schema_3qWNOIsljtInvKJy" }, { "ruleTargetType": "Table", "ruleActionType": "Rename", "ruleName": "Rename_Table_o3PVQq1aIKDGoVVW" }, { "ruleTargetType": "Table", "ruleActionType": "DefineDstTableSettings", "ruleName": "DefineDstTableSettings_Table_BhJltOmOCIc81fzi" }, { "ruleTargetType": "Table", "ruleActionType": "ColumnMapping", "ruleName": "ColumnMapping_Table_nP4hJPX1wh2W3fpo" } ] } ], "sourceDataSourceSettings": [ { "dataSourceProperties": { "timeZone": "Asia/Shanghai" }, "dataSourceName": "autotest_hologres" } ], "jobSettings": { "runtimeSettings": [ ], "ddlHandlingSettings": [ ], "columnDataTypeSettings": [ ], "cycleScheduleSettings": { }, "channelSettings": { "destinationChannelSettings": { "conflictMode": "replace", "dynamicColumnAction": "replay", "writeMode": "replay" }, "sourceChannelSettings": { } } }, "destinationDataSourceType": "Hologres", "transformationRules": [ { "ruleTargetType": "Table", "ruleName": "SourceSchema_Table_BStf8aXPSCJjOWGe", "ruleActionType": "SourceSchema", "ruleExpression": { "columns": [ { "name": "id", "category": "normal", "type": "BIGINT" }, { "name": "decimal", "category": "normal", "type": "DECIMAL" } ] } }, { "ruleTargetType": "Schema", "ruleName": "Rename_Schema_3qWNOIsljtInvKJy", "ruleActionType": "Rename", "ruleExpression": { "expression": "public" } }, { "ruleTargetType": "Table", "ruleName": "Rename_Table_o3PVQq1aIKDGoVVW", "ruleActionType": "Rename", "ruleExpression": { "expression": "auto_holo_2661647_dst" } }, { "ruleTargetType": "Table", "ruleName": "DefineDstTableSettings_Table_BhJltOmOCIc81fzi", "ruleActionType": "DefineDstTableSettings", "ruleExpression": { "ddlString": "BEGIN; CREATE TABLE IF NOT EXISTS public.auto_holo_2661647_dst ( id BIGINT PRIMARY KEY, "decimal" DECIMAL(38,18) ); CALL SET_TABLE_PROPERTY('public.auto_holo_2661647_dst', 'time_to_live_in_seconds', '3153600000'); CALL SET_TABLE_PROPERTY('public.auto_holo_2661647_dst', 'orientation', 'column'); CALL SET_TABLE_PROPERTY('public.auto_holo_2661647_dst', 'binlog.level', 'replica'); CALL SET_TABLE_PROPERTY('public.auto_holo_2661647_dst', 'binlog.ttl', '2592000'); CALL SET_TABLE_PROPERTY('public.auto_holo_2661647_dst', 'bitmap_columns', '"text","char","varchar"'); CALL SET_TABLE_PROPERTY('public.auto_holo_2661647_dst', 'dictionary_encoding_columns', '"text":auto,"bytea":auto,"char":auto,"varchar":auto'); CALL SET_TABLE_PROPERTY('public.auto_holo_2661647_dst', 'distribution_key', '"id"'); COMMIT; ", "ddlType": "STRUCT" } }, { "ruleTargetType": "Table", "ruleName": "ColumnMapping_Table_nP4hJPX1wh2W3fpo", "ruleActionType": "ColumnMapping", "ruleExpression": { "columnMapping": [ { "sourceColName": "id", "dstColName": "id" }, { "sourceColName": "decimal", "dstColName": "decimal" } ] } } ], "migrationType": "FullAndRealtimeIncremental", "destinationDataSourceSettings": [ { "dataSourceProperties": { }, "dataSourceName": "autotest_hologres" } ], "sourceDataSourceType": "Hologres" }

返回參數

名稱

類型

描述

樣本值

object

Schema of Response

Success

boolean

調用是否成功。取值如下:

  • true:調用成功。

  • false:調用失敗。

true

RequestId

string

請求的 ID。用於定位日誌,排查問題。

AAC30B35-820D-5F3E-A42C-E96BB****

樣本

正常返回樣本

JSON格式

{
  "Success": true,
  "RequestId": "AAC30B35-820D-5F3E-A42C-E96BB****"
}

錯誤碼

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情