Configure destination database

更新时间:
复制 MD 格式

This topic describes how to configure a destination database for an ETL task.

Prerequisites

  • ETL tasks can be created only in the following regions: China (Hangzhou), China (Shanghai), China (Qingdao), China (Beijing), China (Zhangjiakou), China (Shenzhen), China (Guangzhou), and China (Hong Kong).

  • The destination database is one of the following types: MySQL, PolarDB for MySQL, Oracle, AnalyticDB for MySQL V3.0, PolarDB for PostgreSQL, PostgreSQL, DB2 for LUW, DB2 for iSeries (AS/400), AnalyticDB for PostgreSQL, SQL Server, MariaDB, PolarDB-X (Formerly DRDS), PolarDB for Oracle, or Tablestore.

  • The destination database must already exist.

  • You have configured the source database and transformation components.

  • The ETL feature does not support schema migration. You must create the required table schemas in the destination database based on your transformation logic. For example, if you join Table A (which contains Field 1, Field 2, and Field 3) and Table B (which contains Field 3, Field 4, and Field 5) to output Field 1, Field 2, Field 3, Field 4, and Field 5, you must create a destination table, Table C, that contains all five of these fields.

Procedure

Note

This procedure uses MySQL as an example.

  1. Go to the Streaming ETL page.

    1. Log in to the DTS console.

    2. In the left-side navigation pane, click ETL.

  2. In the upper-left corner, click the 新增数据流 icon. In the Create Data Flow dialog box, enter a name in the Data Flow Name field, and set Development Method to DAG.

  3. Click Confirm.

  4. Configure the source database. For more information, see Configure a source database.

  5. Configure transformation components. For more information, see Configure transformation components.

  6. From the component list on the left, drag the Output (MySQL) node to the canvas on the right.

  7. Hover over the configured transformation component, click the connection point, and drag a line to connect the component to the Output MySQL-1 node.

  8. Click the Output MySQL-1 node on the canvas. In the panel that appears, configure the destination database.

    1. Configure the node by setting the following parameters.

      Parameter

      Description

      Data source name

      DTS automatically generates a data source name. Specify a descriptive name for easy identification. The name does not need to be unique.

      Region

      Select the region where the destination database is located.

      Instances

      Select the instance that hosts the destination database. You can also click Create Instance to create one. For more information, see Instance management.

      Table mapping

      Select the destination table to store the transformed data.

      In the Select Destination Table section, click the destination table.

    2. On the Field Mapping tab, select the required fields in the Column Name column.

      In this example, the field mapping table contains the following source fields: orderid (int(11)), username (char(32)), ordertime (datetime), commodity (varchar(32)), phonenumber (int(11)), and address (text). Each field is automatically mapped to a destination field of the same name. Note: Flink does not support the datetime type. If a source field is of the datetime type, DTS converts it to the timestamp type, and its value must be within the valid range for a timestamp.

Result

The configuration is complete when the exclamation mark icon 配置源库信息_感叹号 disappears from the right side of the node.