Configure the DM input component

Updated at:

This topic describes how to configure the DM (Dameng) input component to read data from a DM (Dameng) data source into Dataphin for data integration and data development.

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 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 target offline 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. Find the DM component in the list of input components and drag it to the canvas.

  6. Click the image icon on the DM input component card to open the DM (Dameng) Input Configuration dialog box.

  7. In the DM (Dameng) Input Configuration dialog box, configure the parameters.

    Parameter

    Description

    Step name

    The name of the DM input component. Dataphin automatically generates a step name, but you can change it based on your business requirements. The name must follow these rules:

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

    • Cannot exceed 64 characters in length.

    Data source

    In the drop-down list, select a DM (Dameng) data source. This list displays all DM-type data sources in Dataphin, including those for which you have read permission for synchronization and those for which you do not. Click the image icon to copy the current data source name.

    Number of source tables

    Select whether to read from a single table or multiple tables with the same structure. The options are Single table and Multiple tables:

    • Single table: Suitable for scenarios where you synchronize business data from one source table to one destination table.

    • Multiple tables: Suitable for scenarios where you synchronize business data from multiple source tables to a single destination table. A UNION algorithm is used to merge the data.

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

    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 you set Number of source tables to Single table, you can search for a table by entering keywords, 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 Number of source tables to Multiple tables, enter an expression to add tables based on the selected table matching method.

      • If you set Table matching method to General rule, enter a table expression in the input box to filter for tables with the same structure. The system supports enumerations, regular expression-like patterns, and a mix of both. For example: table_[001-100];table_102;.

      • If you set Table matching method to Database regular expression, enter a regular expression that is supported by the source database. The system matches tables in the source database based on this expression. When the task runs, it dynamically matches a new set of tables based on the regular expression.

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

    Split key (Optional)

    The system shards data based on the configured split key. This feature can be used with the concurrency setting to enable parallel reads. You can use a column from the source table as the split key. For optimal performance, using a primary key or an indexed column as the split key is recommended.

    Important

    When a date or time column is selected, the system performs a brute-force split based on the total time range (defined by its minimum and maximum values) and the configured concurrency. This method does not guarantee that the data is split into evenly sized shards.

    Batch size (Optional)

    The number of records to read in a single batch. When reading from the source database, you can configure a specific batch size, such as 1024, instead of reading one record at a time. 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 data, similar to a SQL WHERE clause. For example: ds=${bizdate}. The input filter 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 conditions. You can perform the following operations:

    • Field management: You can remove fields that you do not want to pass to downstream components.

      • To remove a single field: Click the sgaga icon in the Actions column.

      • To remove fields in bulk: Click Field management. In the Field management dialog box, select the fields that you want to remove, click the image move-to-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 bulk by using JSON, TEXT, or DDL format.

      Note

      Clicking OK after using the batch add feature will overwrite any existing field configurations.

      • To configure fields in bulk by using the JSON format, see 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

        index specifies the 1-based column number, 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 third column from the source file, names it user_id, and sets its type to String.

      • To configure fields in bulk by using the TEXT format, see 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). Semicolons (;) and periods (.) are also supported.

        • The column delimiter is used to separate field names from field types. The default is a comma (,), and it supports ','. The field type is optional, and the default is ','.

      • To configure fields in bulk by using the DDL format, see the following example:

        CREATE TABLE tablename (
        	user_id serial,
        	username VARCHAR(50),
        	password VARCHAR(50),
        	email VARCHAR (255),
        	created_on TIMESTAMP,
        );
    • Add output field: Click + Add output field. Enter the Field name, Type, and Comment, and select a mapped type. After you configure the current row, click the image icon to save the new field.

      System fields: You can add system fields to identify the origin of each row of data. This is useful when you synchronize data from multiple tables, such as sharded tables, to a single destination. After you select a system field, the system automatically populates its field type and mapped type. The following system fields are available:

      • dp_datasource: The name of the data source to synchronize.

      • dp_dbname: The name of the database to synchronize (if any).

      • dp_schema: The name of the schema to synchronize (if any).

      • dp_source_table: The name of the source table to synchronize.

      • dp_read_timestamp: The start time of the SELECT statement on the source.

      System fields support concatenating multiple system variables, for example, dp_dbname.dp_source_table.

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

      • dp_read_timestamp can only be configured separately and does not support concatenation.

  8. Click OK to save the configuration.