CreateDIJob
Creates a Data Integration task.
Operation description
You must purchase DataWorks Basic Edition or a more advanced edition to use this feature.
This operation creates a Data Integration synchronization task. The parameters include the source data source settings (SourceDataSourceSettings) and destination data source settings (DestinationDataSourceSettings) of the synchronization task, as well as the supported synchronization type (MigrationType). TransformationRules defines mapping rules applied to synchronized tables, such as adding columns and replacing table names. TableMappings defines the specific tables to be synchronized and the mapping rules to be applied to the tables. JobSettings defines the column mappings and cycle settings of the task.
Try it now
Test
RAM authorization
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| DestinationDataSourceType |
string |
No |
The type of the destination data source. Valid values: Hologres, OSS-HDFS, OSS, MaxCompute, LogHub, StarRocks, DataHub, AnalyticDB_For_MySQL, Kafka, and Hive. |
Hologres |
| Description |
string |
No |
The description of the task. |
DI Job Demo |
| SourceDataSourceType |
string |
No |
The type of the source data source. Valid values: PolarDB, MySQL, Kafka, LogHub, Hologres, Oracle, OceanBase, MongoDB, RedShift, Hive, SQLServer, Doris, and ClickHouse. |
MySQL |
| ProjectId |
integer |
No |
The ID of the DataWorks workspace. You can log on to the DataWorks console and go to the workspace management page to obtain the ID. This parameter is used to determine the DataWorks workspace used when you invoke this API. |
10000 |
| Name |
string |
No |
The name of the task. |
mysql_to_holo_sync_8772 |
| MigrationType |
string |
No |
The synchronization type. Valid values:
|
FullAndRealtimeIncremental |
| JobType |
string |
No |
The task type. Valid values:
The task type must be used in combination with the source data source type, destination data source type, and MigrationType. For example, to synchronize an entire MySQL database to Hologres in real time, set SourceDataSourceType to MySQL, DestinationDataSourceType to Hologres, JobType to DatabaseRealtimeMigration, and MigrationType to FullAndRealtimeIncremental. This configuration performs full synchronization first and then continuous incremental synchronization. For other source and destination data sources, refer to Supported data source types and read and write operations to select a synchronization scenario. |
DatabaseRealtimeMigration |
| SourceDataSourceSettings |
array<object> |
No |
The list of source data source settings. |
|
|
array<object> |
No |
The settings of a single source data source. |
||
| DataSourceName |
string |
No |
The name of the data source. |
mysql_datasource_1 |
| DataSourceProperties |
object |
No |
The properties of the data source. |
|
| Encoding |
string |
No |
The encoding format of the database. |
UTF-8 |
| Timezone |
string |
No |
The time zone. |
Asia/Shanghai |
| ConnectionProperties |
string |
No |
Specify either this parameter or DataSourceName. This parameter specifies the custom connection configuration of the data source, including the instance ID, access identity, and instance region. This parameter is supported only when the data source is configured in instance mode (ConnectionPropertiesMode). Different data sources have different property specifications. For more information, see Connection properties of data sources. |
{ "instanceId": "rm-2ze09gn3x6xxx", "password": "xxxx", "database": "agent", "username": "zmtest" "regionId": "cn-beijing" } |
| DestinationDataSourceSettings |
array<object> |
No |
The list of destination data source settings. |
|
|
array<object> |
No |
The settings of a single destination data source. |
||
| DataSourceName |
string |
No |
The name of the data source. |
holo_datasource_1 |
| DataSourceProperties |
object |
No |
The properties of the data source. |
|
| ConnectionProperties |
string |
No |
Specify either this parameter or DataSourceName. This parameter specifies the custom connection configuration of the data source, including the instance ID, access identity, and instance region. This parameter is supported only when the data source is configured in instance mode (ConnectionPropertiesMode). Different data sources have different property specifications. For more information, see Connection properties of data sources. |
{ "instanceId": "rm-2ze09gn3x6xxx", "password": "xxxx", "database": "agent", "username": "zmtest" "regionId": "cn-beijing" } |
| ResourceSettings |
object |
No |
The resource settings of the synchronization task. This parameter is required when you configure the task by using request parameters. When you use FileSpec to create a task, specify the resource settings in the resourceSettings node of the script. |
|
| OfflineResourceSettings |
object |
No |
The resources for offline synchronization. |
|
| RequestedCu |
number |
No |
The number of CUs used by the Data Integration resource group for offline synchronization. |
2 |
| ResourceGroupIdentifier |
string |
No |
The name of the Data Integration resource group used for offline synchronization. |
S_res_group_111_222 |
| RealtimeResourceSettings |
object |
No |
The resources for real-time synchronization. |
|
| RequestedCu |
number |
No |
The number of CUs used by the Data Integration resource group for real-time synchronization. |
2 |
| ResourceGroupIdentifier |
string |
No |
The name of the Data Integration resource group used for real-time synchronization. |
S_res_group_111_222 |
| ScheduleResourceSettings |
object |
No |
The scheduling resources. |
|
| RequestedCu |
number |
No |
The number of CUs used by the scheduling resource group for the offline synchronization node. |
2 |
| ResourceGroupIdentifier |
string |
No |
The name of the scheduling resource group used for the offline synchronization node. |
S_res_group_222_333 |
| TransformationRules |
array<object> |
No |
The list of transformation rule definitions for synchronization objects. Note
[ { "RuleName":"my_database_rename_rule", "RuleActionType":"Rename", "RuleTargetType":"Schema", "RuleExpression":"{"expression":"${srcDatasoureName}_${srcDatabaseName}"}" } ] |
|
|
object |
No |
A single transformation rule definition for a synchronization object. Each element represents a transformation rule definition. |
||
| RuleActionType |
string |
No |
The action type. Valid values:
|
Rename |
| RuleExpression |
string |
No |
The rule expression in JSON string format.
|
{ "expression": "${srcDatasoureName}_${srcDatabaseName}" } |
| RuleName |
string |
No |
The name of the rule. When the action type and the target type of the action are the same, the rule name must be unique and cannot exceed 50 characters in length. |
rename_rule_1 |
| RuleTargetType |
string |
No |
The target type of the action. Valid values:
|
Table |
| TableMappings |
array<object> |
No |
The list of transformation mappings for synchronization objects. Each element in the list describes a set of source object selection rules and a list of transformation rules applied to the selected synchronization objects. Note
[ { "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> |
No |
Each rule represents a table selected for synchronization. |
||
| SourceObjectSelectionRules |
array<object> |
No |
Each rule selects a set of source objects to be synchronized. Multiple rules combine to select a single table. |
|
|
object |
No |
Each rule can select different object types of the source objects to be synchronized, such as source databases and source tables. |
||
| Action |
string |
No |
The selection action. Valid values: Include and Exclude. |
Include |
| Expression |
string |
No |
The expression. |
mysql_table_1 |
| ExpressionType |
string |
No |
The expression type. Valid values: Exact and Regex. |
Exact |
| ObjectType |
string |
No |
The object type. Valid values:
|
Table |
| TransformationRules |
array<object> |
No |
The list of transformation rule definitions for synchronization objects. Each element in the list represents a transformation rule definition. |
|
|
object |
No |
The transformation rule applied to the source object. |
||
| RuleName |
string |
No |
The name of the rule. The rule name must be unique under a specific combination of action type and target type, and cannot exceed 50 characters in length. |
rename_rule_1 |
| RuleActionType |
string |
No |
The action type. Valid values:
|
Rename |
| RuleTargetType |
string |
No |
The target type of the action. Valid values:
|
Table |
| JobSettings |
object |
No |
The settings at the synchronization task level, including DDL processing policies, column data type mapping policies between the source and destination, and task runtime parameters. |
|
| ChannelSettings |
string |
No |
The channel-related task settings. You can configure specific channels. Currently, Holo2Holo (synchronization from Hologres to Hologres) and Holo2Kafka (synchronization from Hologres to Kafka) are supported.
|
{ "structInfo": "MANAGED", "storageType": "TEXTFILE", "writeMode": "APPEND", "partitionColumns": [ { "columnName": "pt", "columnType": "STRING", "comment": "" } ], "fieldDelimiter": "" } |
| ColumnDataTypeSettings |
array<object> |
No |
The array of column data type mappings. Note
["ColumnDataTypeSettings":[ { "SourceDataType":"Bigint", "DestinationDataType":"Text" } ] |
|
|
object |
No |
A single column data type mapping. |
||
| DestinationDataType |
string |
No |
The destination data type, such as bigint, boolean, string, text, datetime, timestamp, decimal, or binary. Data types vary based on the data source type. |
text |
| SourceDataType |
string |
No |
The source data type, such as bigint, boolean, string, text, datetime, timestamp, decimal, or binary. Data types vary based on the data source type. |
bigint |
| CycleScheduleSettings |
object |
No |
The cycle scheduling settings. |
|
| CycleMigrationType |
string |
No |
The synchronization type that requires cycle scheduling. Valid values:
|
Full |
| ScheduleParameters |
string |
No |
The scheduling parameters. |
bizdate=$bizdate |
| DdlHandlingSettings |
array<object> |
No |
The array of DDL processing settings. Note
["DDLHandlingSettings":[ { "Type":"Insert", "Action":"Normal" } ] |
|
|
object |
No |
A single DDL processing setting. |
||
| Action |
string |
No |
The processing action. Valid values:
|
Critical |
| Type |
string |
No |
The DDL type. Valid values:
|
AddColumn |
| RuntimeSettings |
array<object> |
No |
The runtime settings. |
|
|
object |
No |
|||
| Name |
string |
No |
The setting name. Valid values:
|
runtime.offline.concurrent |
| Value |
string |
No |
The setting value. |
1 |
JobName
deprecated
|
string |
No |
[Deprecated] Use the Name parameter instead. |
mysql_to_holo_sync_8772 |
| Owner |
string |
No |
The owner of the task. |
3726346 |
| FileSpec |
string |
No |
The code content in script mode. |
{ "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" } |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| Id |
integer |
The ID of the Data Integration task. |
11792 |
| RequestId |
string |
The ID of the request. You can use the ID to locate logs and troubleshoot issues. |
4F6AB6B3-41FB-5EBB-AFB2-0C98D49DA2BB |
DIJobId
deprecated
|
integer |
[Deprecated] Use the Id parameter instead. |
11792 |
Examples
Success response
JSON format
{
"Id": 11792,
"RequestId": "4F6AB6B3-41FB-5EBB-AFB2-0C98D49DA2BB",
"DIJobId": 11792
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.