Configure the TDSQL for PostgreSQL input component
To synchronize data from a TDSQL for PostgreSQL data source to a target, first configure the input component to read from the source, and then configure the target data source. This topic describes how to configure the TDSQL for PostgreSQL input component.
Prerequisites
A TDSQL for PostgreSQL data source has been created. For more information, see Create a TDSQL for PostgreSQL data source.
Your account must have the read permission for synchronization on the data source. If you do not have this permission, apply for it. For more information, see Apply for data source permissions.
Procedure
In the top navigation bar of the Dataphin homepage, choose R&D > Data Integration.
In the top navigation bar of the data integration page, select a Project. If you are using the Dev-Prod mode, you also need to select an environment.
In the left navigation bar, click Offline integration, and in the Offline integration list, click the offline pipeline that you want to develop to open its configuration page.
Click Component Library in the upper-right corner of the page to open the Component Library panel.
In the Component Library panel, click Input in the left-side navigation pane. Find the TDSQL for PostgreSQL component in the list of input components and drag it to the canvas.
On the TDSQL for PostgreSQL input component, click the
icon to open the TDSQL for PostgreSQL Input Configuration dialog box.In the TDSQL for PostgreSQL Input Configuration dialog box, configure the parameters.
Parameter
Description
Step name
Dataphin generates a default step name that you can modify based on your business requirements. The name must meet the following rules:
Can contain only Chinese characters, letters, underscores (_), and digits.
Cannot exceed 64 characters.
Data source
The drop-down list displays all TDSQL for PostgreSQL data sources in Dataphin, including those for which you have the read permission for synchronization and those for which you do not. You can click the
icon to copy the current data source name.If you lack the read permission for synchronization for a data source, click Apply to request it. For more information, see Apply for data source permissions.
If you do not have a TDSQL for PostgreSQL data source, click New Data Source in the drop-down list to create one. For more information, see Create a TDSQL for PostgreSQL data source.
Schema
Cross-schema table selection is supported. Select the schema that contains the source table. If you do not specify a schema, the one configured in the data source is used by default.
Number of source tables
Select the number of source tables. Options include single table and multiple tables:
single table: Use this option to synchronize business data from one table to one target table.
multiple tables: Use this option to synchronize business data from multiple tables to the same target table. When data from multiple tables is written to the same target table, the system uses a UNION operation to combine the data.
For more information about the UNION operator, see INTERSECT, UNION, and EXCEPT.
Table matching mode
You can select General rule or Database regex.
NoteThis parameter is available only when multiple tables is selected for Number of source tables.
Table
Select the source tables:
If you selected single table for Number of source tables, you can enter a keyword to search for the table, or enter the exact table name and click Exact Match. After you select a table, the system automatically checks its status. You can click the
icon to copy the name of the selected table.If you selected multiple tables for Number of source tables, enter an expression to add tables based on the selected matching mode.
If you selected General rule as the Table matching mode, enter an expression in the input box to filter for tables with the same structure. The system supports enumerations, regular-like expressions, and a mix of both. For example:
table_[001-100];table_102;.If you selected Database regex as the Table matching mode, enter a regular expression supported by the current database. The system matches tables in the source database based on this regular expression. When the task runs, it dynamically matches and synchronizes new tables that fit the expression.
After entering the expression, you can click Exact Match to view a list of matched tables in the Confirm Matching Details dialog box.
Split key (Optional)
The system shards data based on the configured split key. You can use this parameter with concurrency settings to enable parallel reads. You can specify a column from the source table as the split key. We recommend using a primary key or an indexed column as the split key to ensure optimal performance.
ImportantIf you select a date or time data type, the system performs brute-force splitting based on the detected minimum and maximum values, the total time range, and the concurrency level. This process does not guarantee an even data distribution.
Batch size (Optional)
Specifies the number of records to read per batch. Reading data in batches instead of one record at a time reduces database interactions, improving I/O efficiency and lowering network latency.
Input filter (Optional)
Specify a filter condition for the source data by using an expression similar to a WHERE clause, such as
ds=${bizdate}. The Input filter is suitable for the following scenarios:Filtering a fixed subset of data.
Filtering with parameters.
Output fields
This section displays all fields from the selected tables that match the filter criteria. You can perform the following operations:
Field management: If you do not need to output certain fields to downstream components, you can delete them.
Delete a single field: To delete a small number of fields, click the
icon in the Actions column for the fields you want to delete.Delete fields in bulk: To delete a large number of fields, click Field management. In the Field management dialog box, select multiple fields, click the
left arrow icon to move them to the unselected input fields list, and then click OK to complete the bulk deletion.
Bulk add: Click bulk add to configure fields in bulk by using the JSON, TEXT, or DDL format.
NoteAfter you add fields in bulk, clicking OK overwrites the existing field configuration.
Example of bulk configuration in JSON format:
// Example: [{ "index": 0, "name": "id", "type": "int(10)", "mapType": "Long", "comment": "comment1" }, { "index": 1, "name": "user_name", "type": "varchar(255)", "mapType": "String", "comment": "comment2" }]NoteThe
indexparameter specifies the source column's index,namespecifies the destination field name, andtypespecifies the destination field type.For example,
"index":3,"name":"user_id","type":"String"imports the fourth column from the source, names the fielduser_id, and sets its type toString.Example of bulk configuration in TEXT format:
// Example: 0,id,int(10),Long,comment1 1,user_name,varchar(255),Long,comment2The row delimiter separates the information for each field. The default is a newline character (\n). Semicolons (;) and periods (.) are also supported.
The column delimiter is used to separate field names from field types, and the default is a half-width comma (,). The
','delimiter is supported. The field type is optional, and the default is','.
Example of bulk configuration in DDL format:
CREATE TABLE tablename ( user_id serial, username VARCHAR(50), password VARCHAR(50), email VARCHAR (255), created_on TIMESTAMP, );
Add output field: Click + New output field. In the new row, specify the Field, Type, and Comment, and select a Mapping Type. After you finish configuring the row, click the
icon to save.
Click Confirm to save the component's configuration.

icon to save.