DataWorks Data Integration can write data to SelectDB through single-table or full-database offline synchronization. This topic describes support for SelectDB synchronization.
Supported SelectDB versions
SelectDB Writer uses MySQL Driver 5.1.47. For driver capabilities, see MySQL Connectors. The driver supports these versions:
-
Standard SelectDB versions: 2.2.31 and 2.2.22.
-
Alibaba Cloud SelectDB versions: 2.4, 3.0, and 4.0.
Limits
Writing BITMAP, HLL (HyperLogLog), and QUANTILE_STATE fields is unsupported.
Supported field types
For the full set of field types in each SelectDB version, see SelectDB documentation. The following uses SelectDB 2.2.22 to illustrate supported field types.
|
SelectDB field type |
Offline writes (SelectDB Writer) |
|
INT |
Supported |
|
BIGINT |
Supported |
|
LARGEINT |
Supported |
|
SMALLINT |
Supported |
|
TINYINT |
Supported |
|
BOOLEAN |
Supported |
|
DECIMAL |
Supported |
|
DOUBLE |
Supported |
|
FLOAT |
Supported |
|
CHAR |
Supported |
|
VARCHAR |
Supported |
|
STRING |
Supported |
|
DATE |
Supported |
|
DATEV2 |
Supported |
|
DATETIME |
Supported |
|
DATETIMEV2 |
Supported |
|
ARRAY |
Supported |
|
JSONB |
Supported |
|
BITMATP |
Unsupported |
|
HLL (HyperLogLog) |
Unsupported |
|
QUANTILE_STATE |
Unsupported |
Preparation before synchronization
Before synchronizing data in DataWorks, prepare the SelectDB environment as described here so the service works when you configure and run the task. The preparation steps follow.
Step 1: Check the SelectDB version
Data Integration has SelectDB version requirements. For details, see Supported SelectDB versions. In the SelectDB console, check whether the source meets these requirements.
Step 2: Create an account and configure permissions
We recommend creating a dedicated SelectDB account for DataWorks access. If you use the default admin user of the SelectDB data warehouse, set a password for it.
Step 3: Configure SelectDB network access
SelectDB supports private and public network connections, and Data Integration can use either.
-
Private connection: Recommended for higher bandwidth and more stable connectivity. First, create an endpoint as described in Network configuration. After the endpoint is created and its status changes from Creating to Available and its connection status changes from Connecting... to Connected, bind the VPC containing the endpoint to the VPC containing the resource group. For instructions, see Network connectivity solutions.
-
Public connection: Add the resource group's EIP address to the SelectDB allowlist. For instructions, see Configure a whitelist.
Add a data source
Before you develop a synchronization task in DataWorks, you must add the required data source to DataWorks by following the instructions in Data source configuration. You can view parameter descriptions in the DataWorks console to understand the meanings of the parameters when you add a data source.
The following describes several SelectDB data source settings:
-
MySQL connection address: Enter the JDBC connection string. In the SelectDB console, go to and copy the JDBC connection string. Public and private IP addresses are supported.
-
HTTP connection address: Enter the HTTP access address. In the SelectDB console, go to and copy the HTTP access address. Public and private IP addresses are supported.
-
Username: Enter the SelectDB data warehouse username.
-
Password: Enter the password for the SelectDB data warehouse user.
Develop a data synchronization task
For information about the entry point for and the procedure of configuring a synchronization task, see the following configuration guides.
Single-table offline synchronization configuration guide
-
For the procedure, see Codeless UI configuration and Script mode configuration.
-
For all script-mode parameters and a sample script, see Appendix: SelectDB sample script and parameter descriptions.
Full-database offline synchronization configuration guide
-
Supported source databases: MySQL and PostgreSQL.
-
For the procedure, see Batch database synchronization configuration.
Appendix: SelectDB sample script and parameter descriptions
Configure a batch synchronization task by using the code editor
If you want to configure a batch synchronization task by using the code editor, you must configure the related parameters in the script based on the unified script format requirements. For more information, see Script mode configuration. The following information describes the parameters that you must configure for data sources when you configure a batch synchronization task by using the code editor.
Sample Writer script
{
"stepType": "selectdb",//Plug-in name。
"parameter":
{
"postSql"://SQL statements to run after the synchronization task。
[],
"preSql":
[],//SQL statements to run before the synchronization task。
"datasource":"selectdb_datasource",//Data source name。
"table": "selectdb_table_name",//Table name。
"column":
[
"id",
"table_id",
"table_no",
"table_name",
"table_status"
],
"loadProps":{
"format":"csv",//Specify CSV format
"column_separator": "\\x01",//Specify the column delimiter
"line_delimiter": "\\x02"//Specify the row delimiter
}
},
"name": "Writer",
"category": "writer"
}
Writer script parameters
|
Parameter |
Description |
Required |
Default value |
|
datasource |
Data source name. Script mode supports adding data sources; this value must match the name of the added data source. |
Yes |
None |
|
table |
Name of the table to synchronize. |
Yes |
None |
|
column |
Fields to write to the destination table, separated by commas. For example, |
Yes |
None |
|
preSql |
SQL statements to run before the synchronization task. Wizard mode supports only one statement; script mode supports multiple statements, such as clearing old table data before writing. |
No |
None |
|
postSql |
SQL statements to run after the synchronization task. Wizard mode supports only one statement; script mode supports multiple statements, such as adding a timestamp. |
No |
None |
|
maxBatchRows |
Maximum rows imported per batch. Together with batchSize, it controls batch size. Import starts when either threshold is reached. |
No |
500000 |
|
batchSize |
Maximum amount of data imported per batch. Together with maxBatchRows, it controls batch size. Import starts when either threshold is reached. |
No |
94371840 |
|
maxRetries |
Number of retries after a batch import fails. |
No |
3 |
|
labelPrefix |
Prefix for the label of each uploaded batch. The final label is formed from |
No |
datax_selectdb_writer_ |
|
loadProps |
COPY INTO request parameters, mainly for configuring the import data format. JSON is the default. If loadProps is omitted or set to
To import CSV, specify the format and row and column delimiters as follows. If you omit the delimiters, the data is converted to strings and uses
|
No |
None |
|
clusterName |
SelectDB Cloud cluster name. You can find it in the SelectDB console console. |
No |
None |
|
flushInterval |
Time between data write batches, in milliseconds. If maxBatchRows and batchSize are set very high, data may be imported based on elapsed time before reaching the configured data volume. |
No |
30000 |