Configure the PolarDB input component

Updated at:

The PolarDB input component reads data from a PolarDB data source. When you synchronize data from a PolarDB data source to another data source, you must first configure the PolarDB input component to read from the source, and then configure the target data source. This topic describes how to configure the PolarDB input component.

Prerequisites

Procedure

  1. In the top navigation bar of the Dataphin homepage, choose Develop > Data Integration.

  2. In the top navigation bar of the integration page, select a Project. If you are using the Dev-Prod mode, you also need to select an environment.

  3. In the left-side navigation pane, click offline integration. In the offline integration list, click the offline pipeline you want to develop to open its configuration page.

  4. In the upper-right corner of the page, click component library to open the component library panel.

  5. In the left-side navigation pane of the component library panel, click Input. From the list of input components on the right, find the PolarDB component and drag it to the canvas.

  6. On the PolarDB input component card, click the image icon to open the PolarDB input configuration dialog box.

  7. In the PolarDB input configuration dialog box, configure the parameters.

    Parameter

    Description

    step name

    The name of the PolarDB input component. Dataphin automatically generates a step name, but you can change it as needed. The name must meet the following requirements:

    • Contain only Chinese characters, letters, underscores (_), and digits.

    • Be no more than 64 characters long.

    data source

    In the drop-down list, select a PolarDB data source. The list includes all available PolarDB data sources, regardless of your permission status. Click the image icon to copy the current data source name.

    time zone

    Dataphin processes time-formatted data based on the specified time zone. By default, the time zone configured for the selected data source is used and cannot be modified.

    Note

    For tasks created before version 5.1.2, you can select Data source default or channel configuration time zone. The default option is channel configuration time zone.

    • Data source default: The default time zone of the selected data source.

    • channel configuration time zone: The time zone configured for the current integration task under Properties > channel configuration.

    number of source tables

    Select the number of source tables for data synchronization. The options are single table and multiple tables.

    • single table: Use this option to synchronize data from a single source table to a single target table.

    • multiple tables: Use this option to synchronize data from multiple source tables to a single target table. Dataphin uses a union algorithm to combine the data.

    table matching mode

    Currently, only General Rule can be selected.

    Note

    This parameter is configurable only when number of source tables is set to multiple tables.

    table

    Select the source table or tables.

    • If you set number of source tables to single table, 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. Click the image icon to copy the name of the selected table.

    • If you set number of source tables to multiple tables, perform the following steps to add tables:

      1. In the input box, enter a table expression to match tables with the same schema.

        The system supports enumeration, regular expression-like patterns, and a mix of both. For example: table_[001-100];table_102.

      2. Click exact match to view a list of matching tables in the Confirm Match Details dialog box.

      3. Click Confirm.

    split key (Optional)

    Dataphin shards data based on the specified split key. This parameter, combined with concurrency, enables parallel reads. You can use any column from the source table as the split key. We recommend using the primary key or an indexed column as the split key to ensure optimal transfer performance.

    Important

    If you select a date or time column, Dataphin identifies the minimum and maximum values and splits the data based on the total time range and concurrency level. This process does not guarantee an even data distribution.

    batch size (Optional)

    The number of records to read in a single batch. Instead of reading one record at a time, you can set a batch size, such as 1,024, to read multiple records at once. This reduces interactions with the data source, improves I/O efficiency, and lowers network latency.

    filter (Optional)

    A condition to filter the source data, similar to a SQL WHERE clause. For example, ds=${bizdate}. Use a filter to:

    • Read a fixed subset of data.

    • Filter data by using parameters.

    output field

    This section lists the fields from the selected source table or tables. You can perform the following operations:

    • field management: If you do not want to output certain fields to downstream components, you can remove them.

      • Delete a single field: To remove a small number of fields, click the sgaga icon in the Actions column for the field you want to delete.

      • Delete fields in bulk: To remove a large number of fields, click field management. In the field management dialog box, select the fields you want to remove, click the image left-arrow icon to move them to the unselected list, and then click OK.

        image..png

    • Batch Add: Click Batch Add to configure fields in bulk in JSON, TEXT, or DDL format.

      Note

      After you add fields in bulk and click OK, the new configuration overwrites the existing field configuration.

      • Example of bulk configuration in JSON format:

        // Example:
          [{
             "index": 1,
             "name": "id",
             "type": "int(10)",
             "mapType": "Long",
             "comment": "comment1"
           },
           {
             "index": 2,
             "name": "user_name",
             "type": "varchar(255)",
             "mapType": "String",
             "comment": "comment2"
         }]
        Note

        index specifies the column number, name specifies the field name after import, and type specifies the field type. For example, "index":3,"name":"user_id","type":"String" imports the third column from the source file, names the field user_id, and sets its type to String.

      • Example of bulk configuration in TEXT format:

        // Example:
        1,id,int(10),Long,comment1
        2,user_name,varchar(255),Long,comment2
        • A row delimiter separates each field definition. The default is a newline character (\n), but semicolons (;) and periods (.) are also supported.

        • A comma (,) acts as the column delimiter, separating the index, name, type, mapped type, and comment for each field. The field type can be omitted.

      • 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,
        );
    • New output field: Click + New Output Field and follow the prompts to enter the Field, Type, and Comment, and select a mapped type. After you finish configuring the row, click the image icon to save.

      system field: You can select a system field to identify the source of each row of data. After you select a field, the system automatically populates the field type and mapped type. This is useful for synchronizing data from multiple tables, such as sharded databases and tables, to a single target table. The available system fields include:

      • dp_datasource: The name of the data source being synchronized.

      • dp_dbname: The name of the database being synchronized, if any.

      • dp_schema: The name of the schema being synchronized, if any.

      • dp_source_table: The name of the source table being synchronized.

      • dp_read_timestamp: The start time of the source SELECT operation.

      You can concatenate multiple system fields, for example, dp_dbname.dp_source_table.

      Note
      • The field type and mapped type of a system field cannot be modified.

      • The dp_read_timestamp system field must be configured separately and cannot be concatenated.

  8. Click Confirm to save the configuration for the PolarDB input component.