Configure the PolarDB-X (formerly DRDS) input component

Updated at:

The PolarDB-X (formerly DRDS) input component reads data from a PolarDB-X data source. It is the first step in a pipeline that synchronizes data to a target data source.

Prerequisites

Steps

  1. In the top navigation bar of the Dataphin homepage, choose R&D > Data Integration.

  2. On the Data Integration page, select a project from the top navigation bar. (In Dev-Prod mode, you must also select an environment.)

  3. In the left-side navigation pane, click Batch Integration. In the Batch Integration list, click a batch pipeline 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 Component Library panel, click Input in the left-side navigation pane. In the list of input components on the right, find the PolarDB-X(formerly DRDS) component and drag it to the canvas.

  6. Click the image icon in the PolarDB-X (formerly DRDS) input component card to open the PolarDB-X (formerly DRDS) Input Configuration dialog box.

  7. In the PolarDB-X (formerly DRDS) Input Configuration dialog box, configure the parameters.

    Parameter

    Description

    Step name

    The name of the PolarDB-X input component. Dataphin automatically generates a step name, which you can customize. The name must meet the following requirements:

    • It can contain only Chinese characters, letters, underscores (_), and digits.

    • It must not exceed 64 characters in length.

    Data source

    From the drop-down list, select the PolarDB-X data source. The list displays all PolarDB-X data sources in Dataphin, including those for which you have or lack permissions. Click the image icon to copy the name of the current data source.

    Table

    Select the source table for data synchronization. You can search for the table by entering a keyword, or enter the exact table name and click Exact Search. After you select a table, the system automatically checks its status. Click the image icon to copy the name of the selected table.

    Batch size (Optional)

    Specifies the number of records to read in a single operation. Reading data in batches (for example, 1024 records at a time) reduces interactions with the database, which improves I/O performance and network efficiency.

    Input filter (Optional)

    Specifies a filter condition to extract a subset of data. The syntax is similar to a SQL WHERE clause.

    • Fixed value: Extracts data that matches a specific value. Example: ds=20211111.

    • Variable parameter: Filters data based on a system or custom variable parameter. Example: ds=${bizdate}.

    Output fields

    This section displays all fields from the selected table that match the filter condition. You can perform the following operations:

    • Field Management: Remove fields that are not needed by downstream components.

      • To remove a single field: Click the sgaga icon in the Actions column for the field you want to remove.

      • To remove multiple fields in bulk: 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

    • Click Batch Add to add fields in bulk by using the JSON, TEXT, or DDL format.

      Note

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

      • To add fields in bulk by using the JSON format, see the following example:

        // 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

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

      • To add fields in bulk by using the TEXT format, see the following example:

        // Example:
        1,id,int(10),Long,comment1
        2,user_name,varchar(255),Long,comment2
        • The row separator separates the information of each field, defaults to the newline character (\n), and supports the newline character (\n), a semicolon (;), and a period (.).

        • The column separator is used to separate field names and field types. The default is a half-width comma (,). The supported separator is ',', the field type is optional, and the default is ','.

      • To add fields in bulk by using the DDL format, see the following example:

        CREATE TABLE tablename (
        	user_id serial,
        	username VARCHAR(50),
        	password VARCHAR(50),
        	email VARCHAR (255),
        	created_on TIMESTAMP,
        );
    • Click + New Output Field and enter the Field, Type, and Remarks, and select a Mapping Type. Click the image icon to save the row.

      System fields: System fields identify the origin of each data row. This is useful when synchronizing data from multiple tables (such as sharded databases and tables) to a single target table. When you select a system field, its type and mapping type are populated automatically. The available system fields include:

      • dp_datasource: The name of the source data source.

      • dp_dbname: The name of the source database, if applicable.

      • dp_schema: The name of the source schema, if applicable.

      • dp_source_table: The name of the source table.

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

      You can concatenate multiple system fields. Example: dp_dbname.dp_source_table.

      Note
      • You cannot modify the field type or mapping type of a system field.

      • dp_read_timestamp supports only standalone configuration and cannot be concatenated.

  8. Click OK to save the component's configuration.