All Products
Search
Document Center

DataWorks:CreateDIJob

Last Updated:Jun 11, 2026

Membuat versi baru dari tugas integrasi data.

Deskripsi operasi

  • This API requires DataWorks Basic Edition or a higher edition.

  • This API creates a data integration synchronization task. Key parameters include SourceDataSourceSettings, DestinationDataSourceSettings, and MigrationType. The TransformationRules parameter defines transformation rules for synchronized tables, such as adding columns or replacing table names. The TableMappings parameter specifies which tables to synchronize and their mapping rules. The JobSettings parameter configures task settings, including column mapping and scheduling.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tidak ada otorisasi untuk operasi ini. Jika Anda mengalami masalah saat menjalankan operasi ini, hubungi dukungan teknis.

Parameter permintaan

Parameter

Type

Required

Description

Example

DestinationDataSourceType

string

No

Tipe sumber data tujuan. Nilai valid: Gudang Data Real-time, OSS-HDFS, OSS, MaxCompute, Pusat Log, StarRocks, Bus Data, Database Analitik for MySQL, Kafka, dan Hive.

Hologres

Description

string

No

Deskripsi pekerjaan.

DI Job Demo

SourceDataSourceType

string

No

Tipe sumber data asal. Nilai valid: PolarDB Basis Data Relasional Cloud-Native, MySQL, Kafka, Pusat Log, Gudang Data Real-time, Oracle, OceanBase, MongoDB, Redshift, Hive, SQL Server, Doris, dan ApsaraDB untuk ClickHouse.

MySQL

ProjectId

integer

No

ID ruang kerja DataWorks untuk pemanggilan API ini. Untuk mendapatkan ID ruang kerja, masuk ke Konsol DataWorks dan buka halaman Manajemen Ruang Kerja.

10000

Name

string

No

Nama pekerjaan.

mysql_to_holo_sync_8772

MigrationType

string

No

Tipe sinkronisasi. Nilai valid:

  • FullAndRealtimeIncremental: Sinkronisasi inkremental penuh dan waktu nyata untuk seluruh database.

  • RealtimeIncremental: Sinkronisasi inkremental waktu nyata untuk satu tabel.

  • Full: Sinkronisasi batch penuh untuk seluruh database.

  • OfflineIncremental: Sinkronisasi inkremental dalam mode batch.

  • FullAndOfflineIncremental: Sinkronisasi batch penuh dan inkremental untuk seluruh database.

FullAndRealtimeIncremental

JobType

string

No

Tipe pekerjaan. Nilai valid:

  • DatabaseRealtimeMigration: Mensinkronkan beberapa tabel dari beberapa database sumber secara waktu nyata (sinkronisasi aliran). Tipe ini mendukung sinkronisasi penuh, Sinkronisasi inkremental, atau keduanya.

  • DatabaseOfflineMigration: Mensinkronkan beberapa tabel dari beberapa database sumber secara batch. Tipe ini mendukung sinkronisasi penuh, Sinkronisasi inkremental, atau keduanya.

  • SingleTableRealtimeMigration: Mensinkronkan satu tabel sumber secara waktu nyata (sinkronisasi aliran).

DatabaseRealtimeMigration

SourceDataSourceSettings

array<object>

No

Pengaturan untuk sumber data asal.

array<object>

No

The settings for 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 database encoding format.

UTF-8

Timezone

string

No

The time zone.

Asia/Shanghai

ConnectionProperties

string

No

Custom connection settings for the data source, such as instance ID, access credentials, and instance region. You must specify this parameter or DataSourceName.

This parameter applies only when the data source is configured in instance mode (ConnectionPropertiesMode). The property format varies by data source. For more information, see ConnectionProperties for data sources.

{ "instanceId": "rm-2ze09gn3x6xxx", "password": "xxxx", "database": "agent", "username": "zmtest" "regionId": "cn-beijing" }

DestinationDataSourceSettings

array<object>

No

Pengaturan untuk sumber data tujuan.

array<object>

No

The settings for 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

Custom connection settings for the data source, such as instance ID, access credentials, and instance region. You must specify this parameter or DataSourceName.

This parameter applies only when the data source is configured in instance mode (ConnectionPropertiesMode). The property format varies by data source. For more information, see ConnectionProperties for data sources.

{ "instanceId": "rm-2ze09gn3x6xxx", "password": "xxxx", "database": "agent", "username": "zmtest" "regionId": "cn-beijing" }

ResourceSettings

object

No

Pengaturan Sumber daya.

OfflineResourceSettings

object

No

Resource settings for batch synchronization.

RequestedCu

number

No

The number of CUs for the resource group for data integration that is used for batch synchronization.

2

ResourceGroupIdentifier

string

No

The identifier of the resource group for data integration used for batch synchronization.

S_res_group_111_222

RealtimeResourceSettings

object

No

The resources for real-time synchronization.

RequestedCu

number

No

The number of CUs for the resource group for data integration that is used for real-time synchronization.

2

ResourceGroupIdentifier

string

No

The identifier of the resource group for data integration used for real-time synchronization.

S_res_group_111_222

ScheduleResourceSettings

object

No

The scheduling resources.

RequestedCu

number

No

The number of CUs for the scheduling resource group that is used for batch synchronization jobs.

2

ResourceGroupIdentifier

string

No

The identifier of the scheduling resource group used for batch synchronization jobs.

S_res_group_222_333

TransformationRules

array<object>

No

Daftar aturan transformasi untuk objek yang akan disinkronkan.

Catatan

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

object

No

A single transformation rule.

RuleActionType

string

No

The action type. Valid values:

  • DefinePrimaryKey: Defines a primary key.

  • Rename: Renames an object.

  • AddColumn: Adds a column.

  • HandleDml: Handles DML operations.

  • DefineIncrementalCondition: Defines an incremental condition.

  • DefineCycleScheduleSettings: Defines periodic scheduling settings.

  • DefinePartitionKey: Defines a partition key.

Rename

RuleExpression

string

No

The rule expression, specified as a JSON string.

  1. Renaming rule (Rename)

  • Example: {"expression":"${srcDatasourceName}_${srcDatabaseName}_0922" }

  • expression: The renaming expression. You can use the following variables: ${srcDatasourceName} (name of the source data source), ${srcDatabaseName} (name of the source database), and ${srcTableName} (name of the source table).

  1. Rule for adding a column (AddColumn)

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

  • If you do not specify this rule, no columns are added.

  • columnName: The name of the column to add.

  • columnValueType: The value type of the added column. Valid values: Constant and Variable.

  • columnValue: The value of the added column. If columnValueType is Constant, the value is a custom string constant. If columnValueType is Variable, the value is a built-in variable. Valid built-in variables include: EXECUTE_TIME (execution time, Long), DB_NAME_SRC (source database name, String), DATASOURCE_NAME_SRC (source data source name, String), TABLE_NAME_SRC (source table name, String), DB_NAME_DEST (destination database name, String), DATASOURCE_NAME_DEST (destination data source name, String), TABLE_NAME_DEST (destination table name, String), and DB_NAME_SRC_TRANSED (transformed database name, String).

  1. Rule for defining the primary key columns of a destination table (DefinePrimaryKey)

  • Example: {"columns":["ukcolumn1","ukcolumn2"]}

  • If you do not specify this rule, the primary key columns of the source table are used by default.

  • If the destination is an existing table, Data Integration does not modify its schema. If a specified primary key column does not exist in the destination table, the job fails to start and an error is reported.

  • If the destination table is automatically created, Data Integration automatically creates its schema with the defined primary key columns. If a specified primary key column does not exist in the source table, the job fails to start and an error is reported.

  1. DML handling rule (HandleDml)

  • Example: {"dmlPolicies":[{"dmlType":"Delete","dmlAction":"Filter","filterCondition":"id > 1"}]}

  • If you do not specify this rule, the default dmlAction is Normal for Insert, Update, and Delete operations.

  • dmlType: The DML operation type. Valid values: Insert, Update, and Delete.

  • dmlAction: The DML handling policy. Valid values: Normal (normal processing), Ignore, Filter (conditional processing, used when dmlType is Update or Delete), and LogicalDelete (logical deletion).

  • filterCondition: The DML filter condition, used when dmlAction is Filter.

  1. Incremental condition (DefineIncrementalCondition)

  • Example: {"where":"id > 0"}

  • Specifies the filter condition for incremental synchronization.

  1. Parameters for periodic scheduling (DefineCycleScheduleSettings)

  • Example: {"cronExpress":" * * * * * *", "cycleType":"1"}

  • Specifies the parameters for periodically scheduling a job.

  1. Rule to define a partition key (DefinePartitionKey)

  • Example: {"columns":["id"]}

  • Specifies a partition key.

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

RuleName

string

No

The name of the rule. The rule name must be unique for a specific action type and target object type. Maximum length: 50 characters.

rename_rule_1

RuleTargetType

string

No

The type of the object to which the action applies. Valid values:

  • Table

  • Schema

  • Database

Table

TableMappings

array<object>

No

Pemetaan transformasi untuk objek yang akan disinkronkan. Setiap pemetaan menentukan aturan pemilihan untuk sekelompok objek sumber dan aturan transformasi yang akan diterapkan.

Catatan

[ { "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

A mapping that selects a set of source objects and specifies the transformation rules to apply.

SourceObjectSelectionRules

array<object>

No

Each rule can select a set of source objects to synchronize. Multiple rules combine to select one table.

object

No

A rule that selects source objects of a specific type, such as a database or table.

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

  • Schema

  • Database

Table

TransformationRules

array<object>

No

The names of the transformation rules to apply to the selected objects.

object

No

The transformation rule applied to the source object.

RuleName

string

No

The name of the transformation rule. The rule name must be unique for a specific action type and target object type. Maximum length: 50 characters.

rename_rule_1

RuleActionType

string

No

The action type. Valid values:

  • DefinePrimaryKey: Defines a primary key.

  • Rename: Renames an object.

  • AddColumn: Adds a column.

  • HandleDml: Handles DML operations.

  • DefineIncrementalCondition: Defines an incremental condition.

  • DefineCycleScheduleSettings: Defines periodic scheduling settings.

  • DefinePartitionKey: Defines a partition key.

Rename

RuleTargetType

string

No

The type of the object to which the action applies. Valid values:

  • Table

  • Schema

  • Database

Table

JobSettings

object

No

Pengaturan untuk pekerjaan sinkronisasi, termasuk kebijakan pemrosesan DDL, pemetaan tipe data antara kolom sumber dan tujuan, serta parameter waktu proses.

ChannelSettings

string

No

Settings for data synchronization channels. You can configure special settings for specific channels. The following channels are supported: synchronization from Hologres to Hologres (Holo2Holo) and from Hologres to Kafka (Holo2Kafka).

  1. Holo2Kafka

  • Example: {"destinationChannelSettings":{"kafkaClientProperties":[{"key":"linger.ms","value":"100"}],"keyColumns":["col3"],"writeMode":"canal"}} kafkaClientProperties: Parameters for the Kafka producer.

  • keyColumns: The columns whose values are used as keys for data written to Kafka.

  • writeMode: The data format for writing to Kafka. Valid values: json and canal.

  1. Holo2Holo

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

  • conflictMode: The conflict handling policy for writing data to Hologres. Valid values: replace (overwrite) and ignore.

  • writeMode: The method for writing data to Hologres. Valid values: replay and insert.

  • dynamicColumnAction: The method for handling dynamic columns when writing data to Hologres. Valid values: replay, insert, and ignore.

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

ColumnDataTypeSettings

array<object>

No

Column data type mappings.

Catatan

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

object

No

A mapping from a source data type to a destination data type.

DestinationDataType

string

No

The destination data type. For example: bigint, boolean, string, text, datetime, timestamp, decimal, or binary. Available data types vary by data source.

text

SourceDataType

string

No

The source data type. For example: bigint, boolean, string, text, datetime, timestamp, decimal, or binary. Available data types vary by data source.

bigint

CycleScheduleSettings

object

No

The periodic scheduling settings.

CycleMigrationType

string

No

The synchronization type for periodic scheduling. Valid values:

  • Full: Full synchronization.

  • OfflineIncremental: Incremental synchronization in batch mode.

Full

ScheduleParameters

string

No

The scheduling parameters.

bizdate=$bizdate

DdlHandlingSettings

array<object>

No

DDL handling settings.

Catatan

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

object

No

A single DDL handling setting.

Action

string

No

The handling action. Valid values:

  • Ignore: Ignores the DDL message.

  • Critical: Reports an error.

  • Normal: Processes the DDL message normally.

Critical

Type

string

No

The DDL type. Valid values:

  • RenameColumn: Renames a column.

  • ModifyColumn: Modifies a column.

  • CreateTable: Creates a table.

  • TruncateTable: Truncates a table.

  • DropTable: Drops a table.

  • DropColumn: Drops a column.

  • AddColumn: Adds a column.

AddColumn

RuntimeSettings

array<object>

No

The runtime settings.

object

No

A runtime setting.

Name

string

No

The name of the setting. Valid values:

  • src.offline.datasource.max.connection: The maximum number of connections to the source of a batch synchronization job.

  • dst.offline.truncate: Specifies whether to truncate the destination table before a batch job starts.

  • runtime.offline.speed.limit.enable: Specifies whether to enable throttling for a batch synchronization job.

  • runtime.offline.concurrent: The concurrency level of a batch synchronization job.

  • runtime.enable.auto.create.schema: Specifies whether to automatically create a destination schema.

  • runtime.realtime.concurrent: The concurrency level of a real-time synchronization job.

  • runtime.realtime.failover.minute.dataxcdc: The wait time in minutes for a failover restart.

  • runtime.realtime.failover.times.dataxcdc: The number of failover restart attempts.

runtime.offline.concurrent

Value

string

No

The value of the setting.

1

JobName deprecated

string

No

Parameter ini tidak digunakan lagi. Gunakan parameter Name sebagai gantinya.

mysql_to_holo_sync_8772

Owner

string

No

Pemilik pekerjaan.

3726346

FileSpec

string

No

Kode untuk pekerjaan yang dibuat dalam mode skrip.

{ "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" }

Elemen respons

Element

Type

Description

Example

object

The response schema.

Id

integer

The data integration job ID.

11792

RequestId

string

The request ID. Use this ID to locate logs and troubleshoot issues.

4F6AB6B3-41FB-5EBB-AFB2-0C98D49DA2BB

DIJobId deprecated

integer

This field is deprecated. Use the Id field instead.

11792

Contoh

Respons sukses

JSONformat

{
  "Id": 11792,
  "RequestId": "4F6AB6B3-41FB-5EBB-AFB2-0C98D49DA2BB",
  "DIJobId": 11792
}

Kode kesalahan

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.