Configure the KingbaseES input component

Updated at:

The KingbaseES input component reads data from a KingbaseES data source. To synchronize data from a KingbaseES data source to another, first configure the KingbaseES input component as the source, and then configure the target data source. This topic describes how to configure the KingbaseES input component.

Prerequisites

Procedure

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

  2. In the top navigation bar of the data integration page, select a project. If you are in Dev-Prod mode, you must also select an environment.

  3. In the left-side navigation pane, click offline integration. In the offline integration list, click the offline pipeline that 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, select Input. From the list of input components on the right, find the KingbaseES component and drag it to the canvas.

  6. Click the image icon on the KingbaseES input component card to open the KingbaseES input configuration dialog box.

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

    Parameter

    Description

    Step name

    The name of the KingbaseES input component. Dataphin automatically generates a step name, which you can change 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 in length.

    Data source

    The data source drop-down list displays all KingbaseES data sources in Dataphin, regardless of whether you have the required synchronization permissions. Click the image icon to copy the name of the current data source.

    Number of source tables

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

    • Single table: Synchronizes data from one source table to one target table.

    • Multiple tables: Synchronizes data from multiple source tables to a single target table. When data from multiple tables is written to a single table, the union algorithm is used.

    Table matching mode

    Currently, only General rule can be selected.

    Note

    This setting is supported only when the number of source tables is set to multiple tables.

    Table

    Select the source tables.

    • If you select single table for number of source tables, you can enter a table name keyword to search, 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 select multiple tables for number of source tables, perform the following steps to add tables:

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

        You can use enumeration, regex-like syntax, or a combination of both. For example, table_[001-100];table_102.

      2. Click Exact match to view the list of matched tables in the Confirm matching details dialog box.

      3. Click Confirm.

    Split key (Optional)

    The system shards the data based on the specified split key field. This parameter can be used with the concurrency setting to enable parallel reads. For optimal data transfer performance, we recommend using a column with a primary key or an index as the split key.

    Important

    If you select a date/time data type, the system identifies the minimum and maximum values and then splits the data based on the total time range and the concurrency setting. The splits are not guaranteed to be even.

    Batch read size (Optional)

    Specifies the number of records to read in each batch. Reading data in batches reduces interactions with the data source, improving I/O efficiency and network latency.

    Filter (Optional)

    Enter the filter for the input field, such as ds=${bizdate}. The filter applies to the following two scenarios:

    • Filtering a fixed portion of data.

    • Filtering with parameters.

    Output fields

    The output fields area displays all fields from the selected tables that match the filter criteria. You can perform the following operations:

    • Field management: You can remove any fields that are not required by downstream components.

      • Remove a single field: Click the sgaga icon in the Actions column to remove a specific field.

      • Remove fields in a batch: Click Field management. In the Field management dialog box, select the fields that you want to remove, click the image move-left icon to move them from the selected list to the unselected list, and then click OK.

        image..png

    • Batch add: Click Batch add to configure fields in a batch by using the JSON, TEXT, or DDL format.

      Note

      Clicking OK overwrites all existing field information with the new configuration.

      • To configure fields in JSON format, use 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

        The index parameter specifies the column number, name specifies the output field name, and type specifies the output field type. For example, "index":3,"name":"user_id","type":"String" imports data from the third column of the source file, names the output field user_id, and sets its data type to String.

      • To configure fields in TEXT format, use the following example:

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

        • The column delimiter is used to separate field names from field types. The default is a half-width comma (,), and the ',' character is supported. The field type can be omitted and defaults to ','.

      • To configure fields in DDL format, use the following example:

        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. In the new row, specify the Field, Type, Comment, and mapping type. After you configure the current row, click the image icon to save the row.

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

      • dp_datasource: The name of the data source.

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

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

      • dp_source_table: The name of the source table.

      • dp_read_timestamp: The time when the SELECT statement started executing on the source.

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

      Note
      • The field type and mapping type of system fields cannot be modified.

      • The dp_read_timestamp field must be used alone and cannot be concatenated with other fields.

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