Configure the StarRocks input component

Updated at:

The StarRocks input component reads data from a StarRocks data source. To synchronize data from a StarRocks data source to another, first configure this component to read from the source, and then configure the target data source.

Prerequisites

Procedure

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

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

  3. In the left-side navigation pane, click Offline Integration. In the Offline Integration list, click the offline pipeline 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. Find the StarRocks component in the list on the right and drag it to the canvas.

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

  7. In the StarRocks Input Configuration dialog box, configure the following parameters.

    Parameter

    Description

    Step name

    The name of the StarRocks input component. Dataphin automatically generates a step name, but you can change it based on your business requirements. The naming rules are as follows:

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

    • Cannot exceed 64 characters in length.

    Data source

    The list displays all StarRocks data sources in Dataphin, including those with and without the sync read permission. Click the image icon to copy the current data source name.

    • For a data source for which you do not have the sync read permission, click Apply next to the data source to request the permission. For more information, see Apply for data source permissions.

    • If you do not have any StarRocks data sources, click New Data Source to create one. For more information, see Create a StarRocks data source.

    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 source table to one target table.

    • Multiple tables: Use this option to synchronize data from multiple tables to a single target table. When data from multiple tables is written to the same target table, a union algorithm is used.

    Table matching method

    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 enter keywords to search for a table, 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 selected table name.

    • If Number of source tables is set to Multiple tables, enter an expression to add tables based on the selected table matching method.

      • If Table matching method is set to General Rule: In the input box, enter an expression to filter for tables with the same schema. The system supports enumerations, regex-like patterns, and a mix of both. For example: table_[001-100];table_102;.

      • If Table matching method is set to Database Regular Expression: In the input box, enter a regular expression that is supported by the current database. The system uses this expression to match tables in the source database. At runtime, the task dynamically matches tables for synchronization.

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

    Split key (Optional)

    You can specify an integer column from the source table as the split key. We recommend that you use the primary key or an indexed column as the split key. The system uses the split key to partition data into chunks for parallel processing. This improves data synchronization efficiency.

    Batch read size (Optional)

    The number of records to read in a single batch. Instead of reading one record at a time, you can set a batch read size (for example, 1024) to read multiple records from the source database at once. This reduces the number of interactions with the data source, improves I/O efficiency, and lowers network latency.

    Input filter (Optional)

    Enter a filter condition for the input fields, such as ds=${bizdate}. The input filter is suitable for the following scenarios:

    • Filtering a fixed subset of data.

    • Filtering data by using parameters.

    Output field

    This section displays all fields from the selected tables that match the filter conditions. You can add new fields individually or in batches. If you do not want to output specific fields to downstream components, you can also delete them.

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

      Note

      After you click Confirm, the new fields will overwrite any existing field configurations.

      • To add fields in JSON format, for example:

        // Example:
        [{
          "name": "user_id",
          "type": "String"
         },
         {
          "name": "user_name",
          "type": "String"
         }]
        Note

        The name parameter specifies the imported field's name, and the type parameter specifies its data type. For example, "name":"user_id","type":"String" imports the field named user_id and sets its data type to String.

      • To add fields in TEXT format, for example:

        // Example:
        user_id,String
        user_name,String
        • The row delimiter separates the information for each field. The default delimiter is a newline character (\n). Semicolons (;) and periods (.) are also supported.

        • The column delimiter separates the field name from the field type. The default delimiter is a comma (,).

      • To add fields in DDL format, for example:

        CREATE TABLE tablename (
            id INT PRIMARY KEY,
            name VARCHAR(50),
            age INT
        );
    • New output field: Click + New output field, and then enter a Field name and select a Type.

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

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

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

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

      • 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 variables, for example, dp_dbname.dp_source_table.

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

      • The dp_read_timestamp field can only be configured as a standalone field and cannot be concatenated.

    • Delete a single field: To remove a small number of fields, click the sgaga icon in the Actions column for the target field in the output field list.

      Note

      When the compute engine is StarRocks, you can view the data classification and grading for the output fields of the StarRocks input component. This feature is not supported for other compute engines.

    • Delete fields in batches: To remove a large number of fields, 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 Confirm.

      image..png

  8. Click Confirm to save the configuration of the StarRocks input component.