This topic describes the data types and parameters that are supported by AnalyticDB for MySQL 2.0 Reader and how to configure AnalyticDB for MySQL 2.0 Reader by using the code editor.

AnalyticDB for MySQL 2.0 Reader reads data from tables stored in AnalyticDB for MySQL 2.0 databases. AnalyticDB for MySQL 2.0 Reader connects to a remote AnalyticDB for MySQL 2.0 database by using the Java Database Connectivity (JDBC) URL and executes SQL statements to read data from the AnalyticDB for MySQL 2.0 database in batches based on the recommended page size.

Data types

AnalyticDB for MySQL 2.0 data type Data Integration data type MaxCompute data type
BIGINT LONG BIGINT
TINYINT LONG INT
TIMESTAMP DATE DATETIME
VARCHAR STRING STRING
SMALLINT LONG INT
INT LONG INT
FLOAT STRING DOUBLE
DOUBLE STRING DOUBLE
DATE DATE DATETIME
TIME DATE DATETIME
Note AnalyticDB for MySQL 2.0 Reader does not support the multivalue type. If data of this type exists, AnalyticDB for MySQL 2.0 Reader unexpectedly exits.

Limits

In the current version, data export times out if a large amount of data is exported to a host with low configuration.
  • If the mode parameter is set to Select, AnalyticDB for MySQL 2.0 Reader can read a maximum of 300,000 rows.
  • If the mode parameter is set to ODPS, AnalyticDB for MySQL 2.0 Reader can read a maximum of 100 million rows.
  • AnalyticDB for MySQL 2.0 limits the number of columns that can be read at a time to 50. If you want to cancel this limit, contact the administrator of the AnalyticDB for MySQL 2.0 database.
  • The Java version must be 1.8 and later. native2ascii LocalStrings.properties > LocalStrings_en_US.properties must be used for converting the encoding format.

Parameters

Parameter Description Required Default value
table The name of the table to be exported. Yes No default value
column The columns to be exported. If this parameter is not specified, all columns are exported. No *
limit The maximum number of records that can be exported on one page. No No default value
where The WHERE clause based on which data records are filtered. The string specified by this parameter, such as where id < 100, is added to SQL statements as the query condition. No No default value
mode The export type. Valid values: Select and ODPS.
  • Select: exports data on multiple pages based on the value specified for the limit parameter.
  • ODPS: uses MaxCompute dump to export data. You must have the permissions to access MaxCompute.
No Select
odps.accessKey The AccessKey secret of the Alibaba Cloud account that is used by AnalyticDB for MySQL 2.0 Reader to access MaxCompute. The account must have the Describe, Create, Select, Alter, Update, and Drop permissions. This parameter is required if the mode parameter is set to ODPS. No No default value
odps.accessId The AccessKey ID of the Alibaba Cloud account that is used by AnalyticDB for MySQL 2.0 Reader to access MaxCompute. The account must have the Describe, Create, Select, Alter, Update, and Drop permissions. This parameter is required if the mode parameter is set to ODPS. No No default value
odps.odpsServer The endpoint of the MaxCompute API. This parameter is required if the mode parameter is set to ODPS. No No default value
odps.tunnelServer The endpoint of MaxCompute Tunnel. This parameter is required if the mode parameter is set to ODPS. No No default value
odps.project The name of the MaxCompute project. This parameter is required if the mode parameter is set to ODPS. No No default value
odps.accountType The type of the account that is used to access MaxCompute. This parameter is required if the mode parameter is set to ODPS. No aliyun

Configure AnalyticDB for MySQL 2.0 Reader by using the code editor

{
    "type": "job",
    "steps": [
        {
            "stepType": "ads",
            "parameter": {
                "datasource": "ads_demo",
                "table": "th_test",
                "column": [
                    "id",
                    "testtinyint",
                    "testbigint",
                    "testdate",
                    "testtime",
                    "testtimestamp",
                    "testvarchar",
                    "testdouble",
                    "testfloat"
                ],
                "odps": {
                    "accessId": "<yourAccessKeyId>",
                    "accessKey": "<yourAccessKeySecret>",
                    "account": "*********@aliyun.com",
                    "odpsServer": " http://service.cn.maxcompute.aliyun-inc.com/api",
                    "tunnelServer": "http://dt.cn-shanghai.maxcompute.aliyun-inc.com",
                    "accountType": "aliyun",
                    "project": "odps_test"
                },
                "mode": "ODPS"
            },
            "name": "Reader",
            "category": "reader"
        },
        {
            "stepType": "stream",
            "parameter": {},
            "name": "Writer",
            "category": "writer"
        }
    ],
    "version": "2.0",
    "order": {
        "hops": [
            {
                "from": "Reader",
                "to": "Writer"
            }
        ]
    },
    "setting": {
        "errorLimit": {
            "record": ""
        },
        "speed": {
            "concurrent": 2,
            "throttle": true,// Specifies whether to enable bandwidth throttling. A value of false indicates that bandwidth throttling is disabled, and a value of true indicates that bandwidth throttling is enabled. The mbps parameter takes effect only if the throttle parameter is set to true. 
                  "mbps":"12"// The maximum transmission rate.
        }
    }
}