Updated on 2022-12-08 GMT+08:00

From MySQL

If the source link of a job is the Link to a MySQL Database, configure the source job parameters based on Table 1.

Table 1 Parameter description

Category

Parameter

Description

Example Value

Basic parameters

Use SQL Statement

Whether you can use SQL statements to export data from a relational database

No

SQL Statement

When Use SQL Statement is set to Yes, enter an SQL statement here. CDM exports data based on the SQL statement.

NOTE:
  • SQL statements can only be used to query data. Join and nesting are supported, but multiple query statements are not allowed, for example, select * from table a; select * from table b.
  • With statements are not supported.
  • Comments, such as -- and /*, are not supported.
  • Addition, deletion, and modification operations are not supported, including but not limited to the following:
    • load data
    • delete from
    • alter table
    • create table
    • drop table
    • into outfile

select id,name from sqoop.user;

Schema/Tablespace

Name of the schema or tablespace from which data will be extracted. This parameter is displayed when Use SQL Statement is set to No. Click the icon next to the text box to go to the page for selecting a schema or directly enter a schema or tablespace.

If the desired schema or tablespace is not displayed, check whether the login account has the permissions required to query metadata.

NOTE:

This parameter can be set to a regular expression to export all databases that meet the rule.

SCHEMA_E

Table Name

Name of the table from which data will be extracted. This parameter is displayed when Use SQL Statement is set to No. Click the icon next to the text box to go to the page for selecting the table or directly enter a table name.

If the desired table is not displayed, confirm that the table exists or that the login account has the permissions required to query metadata.

This parameter can be configured as a macro variable of date and time and a path name can contain multiple macro variables. When the macro variable of date and time works with a scheduled job, the incremental data can be synchronized periodically.

NOTE:

This parameter can be set to a regular expression to export all databases that meet the rule.

table

Advanced attributes

Partition Column

This parameter is displayed when Use SQL Statement is set to No, indicating that a field used to split data during data extraction. CDM splits a job into multiple tasks based on this field and executes the tasks concurrently. Fields with data distributed evenly are used, such as the sequential number field.

Click the icon next to the text box to go to the page for selecting a field or directly enter a field.

NOTE:
  • The following types of partition columns are supported: CHAR, VARCHAR, LONGVARCHAR, TINYINT, SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, NUMERIC, DECIMAL, BIT, BOOLEAN, DATE, TIME, and TIMESTAMP. It is recommended that the partition column have an index.
  • If the partition column type is CHAR, VARCHAR, or LONGVARCHAR, the column value cannot contain characters other than those in the ASCII character code table.

id

WHERE Clause

WHERE clause used to specify the data extraction range. This parameter is displayed when Use SQL Statement is set to No. If this parameter is not set, the entire table is extracted.

You can set a date macro variable to extract data generated on a specific date.

DS='${dateformat(yyyy-MM-dd,-1,DAY)}'

Null in Partition Column

Whether the partition column can contain null values

Yes

Job Split Field

Used to split a job into multiple subjobs for concurrent execution.

-

Minimum value of a split field

Specifies the minimum value of Job Split Field during data extraction.

-

Maximum Split Field Value

Specifies the maximum value of Job Split Field during data extraction.

-

Number of subjobs

Specifies the number of subjobs split from a job based on the data range specified by the minimum and maximum values of Job Split Field.

-

Extract by Partition

When data is exported from a MySQL database, data can be extracted from each partition in the partitioned table. If this function is enabled, you can configure Table Partition to specify specific MySQL table partitions from which data is extracted.
  • This function does not support non-partitioned tables.
  • The database user must have the SELECT permission on the system views dba_tab_partitions and dba_tab_subpartitions.

No

  • In a migration from MySQL to DWS, the constraints on the incremental data migration function in MySQL Binlog mode are as follows:
    1. A single cluster supports only one incremental migration job in MySQL Binlog mode in the current version.
    2. In the current version, you are not allowed to delete or update 10,000 data records at a time.
    3. Entire DB migration is not supported.
    4. Data Definition Language (DDL) operations are not supported.
    5. Event migration is not supported.
    6. If you set Migrate Incremental Data to Yes, binlog_format in the source MySQL database must be set to ROW.
    7. If you set Migrate Incremental Data to Yes and binlog file ID disorder occurs on the source MySQL instance due to cross-machine migration or rebuilding during incremental data migration, incremental data may be lost.
    8. If a primary key exists in the destination table and incremental data is generated during the restart of the CDM cluster or full migration, duplicate data may exist in the primary key. As a result, the migration fails.
    9. If the destination DWS database is restarted, the migration will fail. In this case, restart the CDM cluster and the migration job.
  • The recommended MySQL configuration is as follows:
    # Enable the bin-log function.
    log-bin=mysql-bin
    # Row mode
    binlog-format=ROW
    # gtid mode. The recommended version is 5.6.10 or later.
    gtid-mode=ON
    enforce_gtid_consistency = ON