Configure the GBase 8c Reader

Updated at:

The GBase 8c Reader reads data from a GBase 8c data source. To synchronize data from a GBase 8c data source, configure the GBase 8c Reader as the source and then configure the destination component. This topic describes how to configure the GBase 8c Reader.

Prerequisites

Procedure

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

  2. In the top navigation bar, select a project. If you use Dev-Prod mode, you also need to select an environment.

  3. In the left navigation pane, click Batch Integration. In the Batch Integration list, click the target 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 navigation pane of the Component Library panel, select Input. In the input component list on the right, find the GBase 8c component and drag it onto the canvas.

  6. Click the image icon on the GBase 8c Reader card 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

    This parameter specifies the name of the GBase 8c Reader. Dataphin automatically generates a step name, which you can change as needed. The name must meet the following requirements:

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

    • Cannot exceed 64 characters in length.

    Data Source

    In the drop-down list, select a GBase 8c data source. The list displays all GBase 8c data sources, including those for which you have read permission for data synchronization and those for which you do not. You can click the image icon to copy the current data source name.

    Schema (Optional)

    Select the schema that contains the source table. You can select tables from across different schemas. If you leave this parameter empty, the system uses the schema configured in the data source by default.

    Source table mode

    Select a source table mode. Options include Single Table and Multiple Tables.

    • Single Table: Synchronizes data from one source table to one destination table.

    • Multiple Tables: Synchronizes data from multiple source tables to one destination table. The data from the source tables is merged by using a UNION ALL operation.

      For more information about the UNION operator, see INTERSECT, UNION, and EXCEPT.

    Table matching mode

    Specifies the method for matching table names. You can select general rule or database regular expression.

    Note

    This parameter is available only when Source table mode is set to Multiple Tables.

    Table

    Select the source table or tables.

    • If you set Source table mode to Single Table, you can search by keyword 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 image icon to copy the selected table name.

    • If you set Source table mode to Multiple Tables, enter an expression to add tables based on the selected Table matching mode.

      • If you select general rule, enter a table expression to filter tables with the same structure. The system supports enumeration patterns, regex-like patterns, or a combination of both. For example: table_[001-100];table_102;.

      • If you select database regular expression, enter a regular expression that is supported by the current database. The system matches tables in the source database based on the expression. When the task runs, it matches new tables in real time and synchronizes them.

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

    Split key (Optional)

    A column used to partition the source data for parallel reads. You can use this parameter with concurrency settings to enable parallel reading. To improve throughput, we recommend that you use a primary key or an indexed column as the split key.

    Important

    If you select a column of a date or time data type as the split key, the system partitions the data based on the minimum and maximum values and the configured concurrency level. Data distribution across partitions may be uneven.

    Fetch size (Optional)

    The number of rows to fetch from the database in a single batch. Instead of reading data row by row, specifying a fetch size such as 1,024 can improve I/O efficiency and reduce network latency by requiring fewer round trips to the data source.

    Data filter (Optional)

    Specifies a filter condition to apply to the source data, similar to a WHERE clause in an SQL statement. For example, ds=${bizdate}. You can use the data filter in the following scenarios:

    • Read a specific subset of data.

    • Filter data by using parameters.

    Output field

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

    • field management: You can remove fields that you do not want to pass to the downstream component.

      • To delete a single field, click the sgaga icon in the Actions column for that field.

      • To delete multiple fields: Click Field Management. In the Field Management dialog box, select the fields that you want to remove, click the image left arrow icon to move them to the unselected list, and then click OK.

        image..png

    • Add in Batches: Click Add in Batches to configure items in batches in JSON, TEXT, and DDL formats.

      Note

      When you add fields in batches, the new configuration will overwrite any existing field settings.

      • To add fields in JSON format, use the following structure:

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

        In the JSON structure, index specifies the column number, name and type specify the field's name and data type after import, respectively.

        For example, "index":3,"name":"user_id","type":"String" specifies that the fourth column in the source file is imported as a field named user_id with the String data type.

      • To add fields in TEXT format, use the following structure:

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

        • The column delimiter separates the parts of a field definition, such as the name and type. The default is a comma (,); the field type is optional and defaults to String if omitted.

      • To add fields in DDL format, use a standard CREATE TABLE statement:

        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. Enter the Field, Type, and Description, and select the Mapped Type. After you configure the current row, click the image icon to save.

      system field: You can select a system field to identify the source of each row. This is useful when you synchronize data from multiple tables, such as tables in a sharded database, to a single destination. When you select a system field, its type and mapped type are automatically populated. The available system fields include:

      • dp_datasource: The name of the data source.

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

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

      • dp_source_table: The name of the source table.

      • dp_read_timestamp: The timestamp when the SELECT operation started on the source.

      You can concatenate multiple system variables. For example: dp_dbname.dp_source_table.

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

      • dp_read_timestamp can be configured only as a standalone field and cannot be concatenated with other variables.

  8. Click Confirm to complete the property configuration for the GBase 8c input component.