Capability | Description |
Refresh mappings | Click Refresh Mappings Between Source Tables and Destination Tables. Then, the system displays the mappings between source tables and destination tables. In the preceding figure, hudi_b.tb_order_1 is an existing destination Hologres table, and hudi_b.tb_order_2 and hudi_b.tb_order_3 are destination Hologres tables that are automatically created. |
View or modify the schema of a destination table | Find a mapping record and click the name of the destination table to open the dialog box that displays the schema of the table. In the dialog box, you can modify the schema of the table based on your business requirements. In the preceding figure, the add_col field is added to the automatically created destination Hologres table hudi_b.tb_order_3 , the data type of the field is set to TEXT, and the description of the field is set to Add a field to an automatically created destination table. After the modification is complete, click Apply and Refresh Mapping to save the modifications. Important When you modify the schema of an automatically created destination table, you must take note of the following items about the fields that have the same names as fields in the source table: You cannot delete these fields or adjust their order. You cannot change the names of these fields. You can modify the configurations such as the data types and descriptions of these fields. You can also specify whether to use one of the fields as a primary key.
In the preceding figure, the add_col field is added to the existing destination Hologres table hudi_b.tb_order_1 , the data type of the field is set to TEXT, and the description of the field is set to Add a field to an existing destination table. After the modification is complete, click Apply and Refresh Mapping to save the modifications. Important When you modify the schema of an existing destination table, you must take note of the following items: For existing fields in the destination table, you can modify only the descriptions of the fields. You can add fields to the destination table.
|
Modify the schemas of multiple destination tables at a time | Select multiple mapping records and click Batch Modify Table Schema. In the dialog box that appears, you can modify the schemas of the destination tables at a time. After the modification is complete, click Apply and Refresh Mapping to save the modifications. Important After you click Batch Modify Table Schema, the system displays the fields contained in all the selected destination tables in the dialog box that appears. In the dialog box that appears, you can add fields. The preceding figure shows that the batch_add_col field is added to all the selected destination tables.
Then, click the name of a destination table on which the batch operation is performed to view the new schema of the table. |
Specify the name of a destination schema or table | By default, data is written to the destination schema and table that are named the same as the source database and table. If no such destination schema or table exists, the system automatically creates the schema or table in the destination. You can specify the name of the destination schema or table to which you want to write data. For more information, see Configure rules for mapping databases or tables. Note You can use a regular expression to map the names of the destination schemas or tables to the names of source schemas or tables. You can also use built-in variables to specify the names of the destination tables and add a prefix or a suffix to the names of the destination tables.
|
Assign values to the fields that are newly added to a destination table | By default, source fields specified in a full and incremental synchronization task are mapped to destination fields that are named the same as the source fields. The values of the source fields are written to the destination fields that are named the same as the source fields. You can add fields to a destination table and assign constants or variables to the fields as values. You can find the desired mapping record and click Edit in the Value Assignment for Destination Field column. In the dialog box that appears, the new schema of the destination table to which fields are added is displayed. The id and name fields in the hudi_b.tb_order_3 destination Hologres table are also contained in the mapped source table. In this case, the fields are automatically assigned the same values as the values of the mapped source fields, and the values assigned to the destination fields cannot be changed. add_col and batch_add_col are the fields that are newly added to the hudi_b.tb_order_3 destination Hologres table. You can assign values to the fields.
Manually assign a value to a field: You can enter a constant string in the Assignment column of the add_col field. This way, the constant string is written to the add_col field during data synchronization. Use a variable as the value of a field: You can select a built-in variable that represents specific business meaning from the Assignment column of the batch_add_col field. This way, the value that is indicated by the variable is written to the batch_add_col field during data synchronization.
Note Descriptions for the supported variables: DATASOURCE_NAME_SRC: the name of a source DB_NAME_SRC: the name of a source database TABLE_NAME_SRC: the name of a source table DATASOURCE_NAME_DEST: the name of a destination DB_NAME_DEST: the name of a destination database TABLE_NAME_DEST: the name of a destination table DB_NAME_SRC_TRANSED: the name of a source database after conversion EXECUTE_TIME: the time when the event for a change operation on a source occurs
|
Configure rules to process DDL or DML messages | When you configure a full and incremental synchronization task, you can configure rules to process different types of DDL messages for destination tables. For information about the DDL and DML operations supported by different types of destinations, see Supported DML and DDL operations. Note When you configure a batch synchronization task used to synchronize all data in a database, you cannot configure rules to process DDL or DML messages. DataWorks allows you to configure a logical deletion rule for a destination table to process DML messages for deletion operations. After you configure such a rule for a destination table, the system automatically adds the _data_integration_deleted_ field to the table and sets the data type of the field to BOOLEAN. If a deletion operation is performed on a source table in a synchronization task used to synchronize data to Hologres, Hologres automatically converts the original SQL statement that is used to write data to the mapped destination Hologres table to update tb_xxx set _data_integration_deleted_=true where id=xxx and executes the new statement to write data to the mapped destination Hologres table. Logical deletion is implemented during the data write process. After you configure a logical deletion rule for a destination Hologres table, you can view the schema of the table.
|