Configure the GBase 8c input component

Updated at:

To synchronize data from a GBase 8c data source to a target, configure the GBase 8c input component for the source, and then configure the target data source.

Prerequisites

Procedure

  1. On the Dataphin home page, choose Development > Data Integration from the top menu bar.

  2. On the Data Integration page, select a Project from the top menu bar. In Dev-Prod mode, you also need to select an environment.

  3. In the left-side navigation pane, click batch integration. From the batch integration list, click the 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 left-side navigation pane of the Component Library panel, select Input. In the list of input components on the right, find the GBase 8c component and drag it to the canvas.

  6. On the GBase 8c input component card, click the image icon to open the GBase 8c Input Configuration dialog box.

  7. In the GBase 8c Input Configuration dialog box, configure the following parameters.

    Parameter

    Description

    Step name

    Dataphin automatically generates a step name, which you can modify to meet your business requirements. The name must follow these rules:

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

    • It cannot exceed 64 characters.

    Data source

    The Data source drop-down list displays all GBase 8c data sources, regardless of whether you have the read permission for data synchronization. Click the image icon to copy the name of the current data source.

    Schema (Optional)

    You can select tables across schemas. Select the schema where the table resides. If you do not specify a schema, Dataphin uses the schema configured in the data source by default.

    Number of source tables

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

    • single table: Use this option to synchronize data from one table to a single destination table.

    • multiple tables: Use this option to synchronize data from multiple tables to a single destination table. When data from multiple tables is written to the same table, a union operation is performed.

      For more information about union operations, see INTERSECT, UNION, and EXCEPT.

    Table matching mode

    You can select General Rule or Database Regular Expression.

    Note

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

    Table

    Select the source table or tables.

    • If number of source tables is set to single table, you can search for a table by entering a keyword, or enter the exact table name and click Precise Search. After you select a table, the system automatically checks its status. Click the image icon to copy the name of the selected table.

    • If number of source tables is set to multiple tables, you can enter different expressions to add tables depending on the table matching mode.

      • The General rule table matching mode allows you to enter a table expression in the input box to filter tables that have the same structure. The system supports enumeration format, a regular expression-like format, and a mix of both. For example, table_[001-100];table_102;.

      • If you select Database Regular Expression as the table matching mode, enter a regular expression that is supported by the current database in the input box. The system uses this expression to match tables in the target database. When the task runs, it dynamically matches and synchronizes new tables that match the expression.

      After you enter the expression, click Precise Search to view a list of matched tables in the Confirm Match Details dialog box.

    Split key (Optional)

    The system shards the data based on the configured split key. Using this parameter with the concurrency setting enables parallel reads. You can use any column from the source table as the split key. For better performance, use a primary key or an indexed column.

    Important

    If you select a date or time data type, the system performs a brute-force split based on the detected minimum and maximum values, the overall time range, and the concurrency setting. Even data distribution is not guaranteed.

    Batch size (Optional)

    The number of rows to read in a single batch. When reading from the source database, you can configure a specific batch size, such as 1,024, instead of reading one row at a time. This reduces the number of interactions with the data source, improves I/O efficiency, and lowers network latency.

    Filter (Optional)

    Specify a filter condition for the input data, such as ds=${bizdate}. The filter parameter is useful in the following scenarios:

    • Filtering a fixed subset of data.

    • Filtering data by using parameters.

    Output fields

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

    • Manage fields: If you do not need to output certain fields to downstream components, you can remove them.

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

      • To remove multiple fields: If you need to remove many fields, click Manage Fields. In the Manage Fields dialog box, select the fields 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 by using JSON, TEXT, or DDL format.

      Note

      Adding fields in bulk and clicking OK overwrites the existing field configuration.

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

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

        index specifies the column number, name specifies the imported field name, and type specifies the imported field type.

        For example, "index":3,"name":"user_id","type":"String" imports the fourth column from the file, names the field user_id, and sets the field type to String.

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

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

        • A comma (,) is used as the column delimiter to separate attributes like the field name and type. The field type is optional. Use a comma (,) as a placeholder for omitted optional attributes.

      • 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,
        );
    • Add an output field: Click + Add Output Field, and then specify the Field, Type, and Comment, and select a Mapping Type. After you configure the current row, click the image icon to save.

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

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

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

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

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

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

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

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

      • The dp_read_timestamp field must be configured independently and cannot be concatenated.

  8. Click OK to save the GBase 8c input component configuration.