You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/guides/40-load-data/02-load-db/datax.md
+2-118Lines changed: 2 additions & 118 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,122 +24,6 @@ DatabendWriter supports two operational modes: INSERT (default) and REPLACE. In
24
24
25
25
If you need more information about DatabendWriter and its functionalities, you can refer to the documentation available at https://github.com/alibaba/DataX/blob/master/databendwriter/doc/databendwriter.md
26
26
27
-
## Tutorial: Data Loading from MySQL
27
+
## Tutorials
28
28
29
-
In this tutorial, you will load data from MySQL to Databend with DataX. Before you start, make sure you have successfully set up Databend, MySQL, and DataX in your environment.
30
-
31
-
1. In MySQL, create a SQL user that you will use for data loading and then create a table and populate it with sample data.
32
-
33
-
```sql title='In MySQL:'
34
-
mysql> create user 'mysqlu1'@'%' identified by 'databend';
35
-
mysql>grant all on*.* to 'mysqlu1'@'%';
36
-
mysql> create database db;
37
-
mysql> create table db.tb01(id int, d double, t TIMESTAMP, col1 varchar(10));
2. In Databend, create a corresponding target table.
42
-
43
-
:::note
44
-
DataX data types can be converted to Databend's data types when loaded into Databend. For the specific correspondences between DataX data types and Databend's data types, refer to the documentation provided at the following link: https://github.com/alibaba/DataX/blob/master/databendwriter/doc/databendwriter.md#33-type-convert
45
-
:::
46
-
47
-
```sql title='In Databend:'
48
-
databend> create database migrated_db;
49
-
databend> create table migrated_db.tb01(id intnull, d double null, t TIMESTAMPnull, col1 varchar(10) null);
50
-
```
51
-
52
-
3. Copy and paste the following code to a file, and name the file as *mysql_demo.json*. For the available parameters and their descriptions, refer to the documentation provided at the following link: https://github.com/alibaba/DataX/blob/master/databendwriter/doc/databendwriter.md#32-configuration-description
The provided code above configures DatabendWriter to operate in the INSERT mode. To switch to the REPLACE mode, you must include the writeMode and onConflictColumn parameters. For example:
115
-
116
-
```json title='mysql_demo.json'
117
-
...
118
-
"writer": {
119
-
"name": "databendwriter",
120
-
"parameter": {
121
-
"writeMode": "replace",
122
-
"onConflictColumn":["id"],
123
-
"username": ...
124
-
```
125
-
:::
126
-
127
-
4. Run DataX:
128
-
129
-
```shell
130
-
cd {YOUR_DATAX_DIR_BIN}
131
-
python datax.py ./mysql_demo.json
132
-
```
133
-
134
-
You're all set! To verify the data loading, execute the query in Databend:
In this tutorial, you will load data from MySQL to Databend with DataX. Before you start, make sure you have successfully set up Databend, MySQL, and DataX in your environment.
6
+
7
+
1. In MySQL, create a SQL user that you will use for data loading and then create a table and populate it with sample data.
8
+
9
+
```sql title='In MySQL:'
10
+
mysql> create user 'mysqlu1'@'%' identified by 'databend';
11
+
mysql>grant all on*.* to 'mysqlu1'@'%';
12
+
mysql> create database db;
13
+
mysql> create table db.tb01(id int, d double, t TIMESTAMP, col1 varchar(10));
2. In Databend, create a corresponding target table.
18
+
19
+
:::note
20
+
DataX data types can be converted to Databend's data types when loaded into Databend. For the specific correspondences between DataX data types and Databend's data types, refer to the documentation provided at the following link: https://github.com/alibaba/DataX/blob/master/databendwriter/doc/databendwriter.md#33-type-convert
21
+
:::
22
+
23
+
```sql title='In Databend:'
24
+
databend> create database migrated_db;
25
+
databend> create table migrated_db.tb01(id intnull, d double null, t TIMESTAMPnull, col1 varchar(10) null);
26
+
```
27
+
28
+
3. Copy and paste the following code to a file, and name the file as *mysql_demo.json*. For the available parameters and their descriptions, refer to the documentation provided at the following link: https://github.com/alibaba/DataX/blob/master/databendwriter/doc/databendwriter.md#32-configuration-description
The provided code above configures DatabendWriter to operate in the INSERT mode. To switch to the REPLACE mode, you must include the writeMode and onConflictColumn parameters. For example:
91
+
92
+
```json title='mysql_demo.json'
93
+
...
94
+
"writer": {
95
+
"name": "databendwriter",
96
+
"parameter": {
97
+
"writeMode": "replace",
98
+
"onConflictColumn":["id"],
99
+
"username": ...
100
+
```
101
+
:::
102
+
103
+
4. Run DataX:
104
+
105
+
```shell
106
+
cd {YOUR_DATAX_DIR_BIN}
107
+
python datax.py ./mysql_demo.json
108
+
```
109
+
110
+
You're all set! To verify the data loading, execute the query in Databend:
0 commit comments