Configure the PolarDB-X2.0 Output Component
The PolarDB-X2.0 output component writes data to a PolarDB-X2.0 data source. When you sync data from other data sources to a PolarDB-X2.0 data source, configure the target data source for the PolarDB-X2.0 output component after you configure the source data. This topic describes how to configure the PolarDB-X2.0 output component.
Prerequisites
You have created a PolarDB-X2.0 data source. For more information, see Create a PolarDB-X2.0 Data Source.
The account used to configure the PolarDB-X2.0 output component has write-through permission on the data source. If the account does not have this permission, request it. For more information, see Request, Renew, or Release Data Source Permissions.
Procedure
On the Dataphin homepage, in the top menu bar, click Develop, and then click Data Integration.
On the Data Integration page, in the top menu bar, select a Project. In Dev-Prod mode, also select an environment.
In the left navigation pane, click Batch Pipeline. In the Batch Pipeline list, click the offline pipeline that you want to develop. The offline pipeline configuration page opens.
In the upper-right corner of the page, click Component Library to open the Component Library panel.
In the left navigation pane of the Component Library panel, click Output. In the list on the right, locate the PolarDB-X2.0 component and drag it onto the canvas.
Click and drag the
icon of the input component to connect it to the PolarDB-X2.0 output component.In the PolarDB-X2.0 output component card, click the
icon to open the PolarDB-X2.0 Output Configuration dialog box.
In the PolarDB-X2.0 Output Configuration dialog box, configure the following parameters.
Parameter
Description
Basic Settings
Step Name
The name of the PolarDB-X2.0 output component. Dataphin generates a step name automatically. You can change it based on your business scenario. Naming rules:
Use only Chinese characters, letters, underscores (_), and digits.
Keep the name up to 64 characters long.
Datasource
The drop-down list shows all PolarDB-X2.0 data sources. It includes data sources for which you have write-through permission and those for which you do not. Click the
icon to copy the current data source name.If you do not have write-through permission for a data source, click Request next to the data source to request permission. For details, see Request Data Source Permissions.
If you do not have a PolarDB-X2.0 data source, click the
icon to create one. For details, see Create a PolarDB-X2.0 Data Source.
Database (Optional)
Select the database where the table resides. If you leave this field blank, the database specified when you registered the data source is used.
Table
Select the target table for output data. Enter a keyword to search for tables or enter the exact table name and click Exact Search. After you select a table, the system checks its status automatically. Click the
icon to copy the selected table name.If the target table does not exist in the PolarDB-X2.0 data source, use the one-click table creation feature to generate it quickly. Follow these steps:
Click One-Click Table Creation. Dataphin automatically matches code to create the target table, including the table name (default: source table name) and field types (preliminarily converted from Dataphin fields).
Modify the SQL script as needed and click Create. After the table is created, Dataphin uses it as the target table for output data.
NoteIf a table with the same name exists in the development environment, clicking Create returns an error that the table already exists.
If no matching table is found, you can still integrate using a manually entered table name.
Production Table Missing Policy
The action to take if the production table does not exist. Choose No Action or Automatic Creation. Default: Automatic Creation. If you choose No Action, the task publishes without creating the production table. If you choose Automatic Creation, the task creates a table with the same name in the target environment during publishing.
No Action: If the target table does not exist, a warning appears during submission, but the task still publishes. You must create the target table in the production environment before running the task.
Automatic Creation: Edit the CREATE TABLE Statement. By default, the statement for the selected table is filled in. You can adjust it. Use the placeholder
${table_name}for the table name. Only this placeholder is supported. At runtime, it is replaced with the actual table name.If the target table does not exist, Dataphin first runs the CREATE TABLE statement. If table creation fails, publishing fails. Fix the statement based on the error message and republish. If the target table already exists, no action is taken.
NoteThis setting is available only for projects in Dev-Prod mode.
Loading Policy
Select the loading strategy for the target table. The Loading Policy includes:
Append Data (INSERT INTO): Returns a dirty data error if a primary key or constraint conflict occurs.
Replace on Conflict (REPLACE INTO): Deletes the existing row with the same primary key or constraint and inserts the new row.
Update on Conflict (ON DUPLICATE KEY UPDATE): Updates mapped fields in the existing record if a primary key or constraint conflict occurs.
Batch Write Size (Optional)
The data volume per write operation. You can also configure the Batch Write Count. During write operations, the system writes data based on whichever of these two configurations reaches its limit first. The default value is 32 MB.
Batch Write Count (Optional)
Default: 2,048 records. During data synchronization, Dataphin uses batch writing. Parameters include Batch Write Count and Batch Write Size.
When the accumulated data reaches either limit—batch size or record count—the system writes the batch to the target immediately.
We recommend setting the batch size to 32 MB. Adjust the batch record count based on the average record size. Use a larger value to maximize batch efficiency. For example, if each record is about 1 KB, set the batch size to 16 MB and the batch record count to more than 16,384 (16 MB ÷ 1 KB). Here, we use 20,000 records. With this setup, the system triggers batch writes when the accumulated data reaches 16 MB.
Pre-Statement (Optional)
An SQL script to run on the database before data import.
For example, to ensure continuous service availability: before writing data, create the target table Target_A; then write data to Target_A; after writing completes, rename the live service table Service_B to Temp_C; rename Target_A to Service_B; and delete Temp_C.
Post-Statement (Optional)
An SQL script to run on the database after data import.
Field Mapping
Input Fields
Lists input fields from upstream components.
Output Fields
Lists output fields. Supported actions:
Field Management: Click Field Management to select output fields.

Click the
icon to move Selected Input Fields to Unselected Input Fields.Click the
icon to move Unselected Input Fields to Selected Input Fields.
Batch Add: Click Batch Add to configure fields in JSON, TEXT, or DDL format.
JSON format example:
// Example: [{ "name": "user_id", "type": "String" }, { "name": "user_name", "type": "String" }]NoteThe "name" field is the field name. The "type" field is the data type after import. For example,
"name":"user_id","type":"String"imports the field named user_id and sets its type to String.TEXT format example:
// Example: user_id,String user_name,StringThe row delimiter separates field entries. Default: line feed (\n). Supported delimiters: \n, semicolon (;), and period (.).
The column delimiter separates field names from field types. Default: comma (,).
DDL format example:
CREATE TABLE tablename ( id INT PRIMARY KEY, name VARCHAR(50), age INT );
Create Output Field: Click + Create Output Field. Enter the Column name and select the Type. Click the
icon to save the row.
Mapping
Manually map fields between upstream inputs and target table fields. Quick Mapping options are Row Mapping and Name Mapping.
Name Mapping: Maps fields with identical names.
Row Mapping: Maps fields by position when source and target field names differ but their rows correspond.
Click Confirm to complete the configuration of the PolarDB-X2.0 output component.
icon to copy the selected table name.
icon to save the row.