Parameter | Description | Required | Default value |
datasource | The name of the data source. It must be the same as the name of the added data source. You can add data sources by using the code editor. | Yes | No default value |
table | The name of the table to which you want to write data. | Yes | No default value |
writeMode | The write mode. The following modes are supported: insert into, on duplicate key update, and replace into. insert into: If a primary key conflict or unique index conflict occurs, data cannot be written to the conflicting rows, and the data that is not written to these rows is regarded as dirty data. If you configure a synchronization task by using the code editor, set writeMode to insert. on duplicate key update: If no primary key conflict or unique index conflict occurs, the data is processed in the same way as that when you set this parameter to insert . If a conflict occurs, specified fields in the original rows are replaced with new rows, and data is written to MySQL. If you configure a synchronization task by using the code editor, set writeMode to update. replace into: If no primary key conflict or unique index conflict occurs, the data is processed in the same way as that when you set this parameter to insert . If a conflict occurs, the original rows are deleted, and new rows are inserted. This indicates that all fields of the original rows are replaced. If you configure a synchronization task by using the code editor, set writeMode to replace.
| No | insert |
nullMode | The policy for processing a NULL value. Valid values: writeNull: If the value in a column at the source is NULL , the NULL value is written to the corresponding column at the destination. skipNull: If the value in a column at the source is NULL , the NULL value is not written to the corresponding column at the destination. If a default value is specified for the column at the destination, the default value is used. If no default value is specified, NULL is used. If you set the nullMode parameter to skipNull, you must also configure the skipNullColumn parameter.
Important If you set this parameter to skipNull, SQL statements that are used to write data are dynamically concatenated to support a default value at the destination. This increases the number of flushes and slows down data synchronization. In the worst case, each data record is flushed once. | No | writeNull |
skipNullColumn | Specifies the columns in which NULL values need to be skipped. When you set the nullMode parameter to skipNull, the NULL value is not forcefully written to the columns that are specified by this parameter. The default values that are specified for the columns are preferentially used. Configure this parameter in the format of ["c1", "c2", ...] . c1 and c2 must be replaced with subsets of the columns specified by the column parameter. | No | All columns configured for the task |
column | The names of the columns to which you want to write data. Separate the names with commas (,), such as "column": ["id", "name", "age"] . If you want to write data to all the columns in the destination table, set this parameter to an asterisk (*), such as "column": ["*"] . | Yes | No default value |
preSql | The SQL statement that you want to execute before the synchronization task is run. You can execute only one SQL statement on the codeless UI and multiple SQL statements in the code editor. For example, you can execute the TRUNCATE TABLE tablename statement to delete outdated data before the synchronization task is run. Note If you configure multiple SQL statements, the statements are not executed in the same transaction. | No | No default value |
postSql | The SQL statement that you want to execute after the synchronization task is run. You can execute only one SQL statement on the codeless UI and multiple SQL statements in the code editor. For example, you can execute the alter table tablename add colname timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP statement to add a timestamp after the synchronization task is run. Note If you configure multiple SQL statements, the statements are not executed in the same transaction. | No | No default value |
batchSize | The number of data records to write at a time. Set this parameter to an appropriate value based on your business requirements. This greatly reduces the interactions between Data Integration and MySQL and increases throughput. If you set this parameter to an excessively large value, an out of memory (OOM) error may occur during data synchronization. | No | 256 |
updateColumn | The names of columns that are updated when a primary key conflict or unique index conflict occurs. This parameter takes effect only when the writeMode parameter is set to on duplicate key update. Separate multiple column names with commas (,). Example: "updateColumn":["name", "age"] . | No | No default value |