DATAX 从scv到csv 从csv到mysql

csv到csv

 1 {
 2     "setting": {},
 3     "job": {
 4         "setting": {
 5             "speed": {
 6                 "channel": 2
 7             }
 8         },
 9         "content": [
10             {
11                 "reader": {
12                     "name": "txtfilereader",
13                     "parameter": {
14                         "path": ["E:/DATAX/Workplace/TEXT/csv/catalogue.csv"],
15                         "encoding": "UTF-8",
16                         "column": [
17                             {
18                                 "index": 0,
19                                 "type": "string"
20                             },
21                             {
22                                 "index": 1,
23                                 "type": "string"
24                             }
25                         ],
26                         "fieldDelimiter": ",",
27                         "skipHeader": "False"
28                     }
29                 },
30                 "writer": {
31                     "name": "txtfilewriter",
32                     "parameter": {
33                         "path": "E:/DATAX/Workplace/TEXT/csv",
34                         "fileName": "in.csv",
35                         "writeMode": "truncate",
36                         "format": "yyyy-MM-dd",
37                         "header":['id', 'info']
38                     }
39                 }
40             }
41         ]
42     }
43 }

从csv到mysql

 1 {
 2     "job": {
 3         "setting": {
 4             "speed": {
 5                 "channel": 2
 6             }
 7         },
 8         "content": [
 9             {
10                "reader": {
11                     "name": "txtfilereader",
12                     "parameter": {
13                         "path": ["E:/DATAX/Workplace/TEXT/csv/catalogue.csv"],
14                         "encoding": "UTF-8",
15                         "column": [
16                             {
17                                 "index": 0,
18                                 "type": "string"
19                             },
20                             {
21                                 "index": 1,
22                                 "type": "string"
23                             }
24                         ],
25                         "fieldDelimiter": ",",
26                         "skipHeader": "False"
27                     }
28                 },
29                 
30                "writer": {
31 
32                     "name": "mysqlwriter",
33 
34                     "parameter": {
35 
36                         "writeMode": "insert",
37 
38                         "username": "root",
39 
40                         "password": "zb753951",
41 
42                         "column": [
43 
44                             "name",
45 
46                             "value"
47 
48                         ],
49 
50                         "session": [],
51 
52                         "connection": [
53 
54                             {
55 
56                                 "jdbcUrl": "jdbc:mysql://127.0.0.1:3306/datax?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8",
57 
58                                 "table": ["csv1"]
59 
60                             }
61 
62                         ]
63 
64                     }
65 
66                 }
67                 
68                 
69             }
70         ]
71     }
72 }

 

posted @ 2020-02-28 17:46  博二爷  阅读(697)  评论(0编辑  收藏  举报