In a DataWorks Data Integration real-time synchronization task for a single table, use the field editing and value assignment component to write new fields to the destination.
Step 1: Configure a Data Integration task
-
Create a data source. For more information, see Data source management.
-
Create a Data Integration task. For more information, see Configure a real-time synchronization task for a single table.
NoteFor a Data Integration real-time synchronization task for a single table, you can add a data processing component between the source and destination components. For more information, see Supported data sources and synchronization solutions.
Step 2: Add field editing and value assignment
-
In the configuration of the real-time synchronization task for a single table, turn on the Data Processing switch, click +Add Node, and add the Edit Field and Assign Value component.
-
Configure the field editing and value assignment component.
In this example, the upstream Kafka source outputs the following fields:
_key_(STRING),_value_(STRING),_partition_(LONG),_offset_(LONG),_timestamp_(LONG), and_headers_(STRING). All of these fields are selected for downstream output. This example adds a custom field namedadd_colof type STRING, sets the value assignment method to constant, and sets the value to1.-
Ancestor fields
-
Field Name: The name of an output field from the ancestor component.
-
Type: The data type of an output field from the ancestor component.
-
Value: For an existing ancestor field, the value is its output. For a new field, you can choose one of the following value assignment methods: constant, variable, or function.
-
Actions: For an ancestor field, you can choose whether to pass its output to the downstream component.
-
-
Custom Field: Click Add Field in the lower-left corner of the page to add a new field.
-
Constant: Converts a manually entered constant string to the specified data type and assigns it to the new field.
-
Variable: Assigns the value of a built-in variable to the new field when the task runs. The following table lists the supported built-in variables.
NoteSupport for these variables depends on the specific source and destination systems.
-
Function: This option uses a function to perform calculations at runtime and assigns the results to the new field. If an exception occurs, the system treats the record as dirty data, includes it in the task's dirty data statistics, and then decides whether to terminate the task based on the configured dirty data tolerance.
-
-
Next steps
After configuring the source and field editing and value assignment components, click Output Preview to preview the node's output data and verify its correctness. To write the new fields to the destination table, you must first configure their mappings in the field mapping settings.