Configure the OushuDB input component

Updated at:

The OushuDB input component reads data from an OushuDB data source. To synchronize data from an OushuDB data source to another, you first configure the OushuDB input component to read from the source, and then configure a destination component. This topic describes how to configure the OushuDB input component.

Prerequisites

Procedure

  1. On the Dataphin homepage, choose Develop > Data Integration from the top menu bar.

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

  3. In the left-side navigation pane, click Offline Integration. From the Offline Integration list, click the desired offline pipeline to open its configuration page.

  4. Click Component Library in the upper-right corner of the page to open the Component Library panel.

  5. In the left-side navigation pane of the Component Library panel, select Input. Find the OushuDB component in the list on the right and drag it onto the canvas.

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

  7. In the OushuDB input configuration dialog box, configure the following parameters.

    Parameter

    Description

    Step Name

    The name of the OushuDB input component. Dataphin automatically generates a step name, which you can modify. The name must follow these rules:

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

    • Must be no more than 64 characters in length.

    Data source

    The drop-down list displays all OushuDB data sources, including those for which you have sync read permission and those you do not. Click the image icon to copy the current data source name.

    Time zone

    The specified time zone is used to process time-based data. By default, this is the time zone configured in the selected data source and cannot be changed.

    Note

    For tasks created before V5.1.2, you can select Data source default configuration or Channel configuration time zone. The default is Channel configuration time zone.

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

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

    Schema (non-required)

    You can select tables from different schemas. If you do not specify a schema, the schema configured for the data source is used by default.

    Table Source Mode

    Select the mode for specifying source tables. Options include Single table and Multiple tables:

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

    • Multiple tables: Use this option to synchronize data from multiple source tables to a single destination table. A union operation merges the data from the source tables.

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

    Table matching method

    You can select either Generic pattern or database regular expression.

    Note

    This parameter is available only when Table Source Mode is set to Multiple tables.

    Table

    Select the source table or tables:

    • If you set Table Source Mode to Single table, you can search for a table by entering a keyword, 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 Table Source Mode to Multiple tables, enter an expression to add tables based on the selected matching method.

      • If you select Generic pattern as the matching method, enter an expression to match tables with identical structures. The system supports enumerated lists, regular expression-like patterns, and a mix of both. For example, table_[001-100];table_102;.

      • If you select database regular expression as the matching method, enter a regular expression that is supported by the current database. The system uses this expression to match tables in the target database. When the task runs, it dynamically matches a new range of tables for synchronization.

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

    Split key (non-required)

    The system partitions data based on the split key, enabling parallel data reading with the specified concurrency. Specify a source table column as the split key. For optimal performance, we recommend using a primary key or an indexed column.

    Important

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

    Batch Read Size (non-required)

    This parameter specifies the number of records to read in a single batch. For example, setting this to 1024 means reading 1024 records at once instead of one by one. This practice reduces interactions with the data source, improving I/O efficiency and network performance.

    Filter (non-required)

    Enter a filter condition for the input fields, similar to a WHERE clause. For example: ds=${bizdate}. The Filter parameter is useful in the following scenarios:

    • Reading a fixed subset of data.

    • Filtering data by using parameters.

    Output Fields

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

    • Field Management: Remove fields that you do not need to output to 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 multiple fields, 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

      After you complete the bulk add, clicking OK overwrites the configured field information.

      • Example of batch configuration in JSON format:

        // 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 index, name specifies the field name after import, and type specifies the field type after import.

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

      • Example of batch configuration in TEXT format:

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

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

      • Example of batch configuration in DDL format:

        CREATE TABLE tablename (
        	user_id serial,
        	username VARCHAR(50),
        	password VARCHAR(50),
        	email VARCHAR (255),
        	created_on TIMESTAMP,
        );
    • Create an output field: Click +Create Output Field, then enter the Field, Type, and Remarks, and select the Mapping Type. After you finish configuring the row, click the image icon to save.

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

      • dp_datasource: Name of the data source.

      • dp_dbname: Name of the database (if any).

      • dp_schema: Name of the schema (if any).

      • dp_source_table: Name of the source table.

      • dp_read_timestamp: Start time of the source SELECT operation.

      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 configured independently and cannot be concatenated with other variables.

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