-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatax_t.py
More file actions
70 lines (65 loc) · 1.79 KB
/
datax_t.py
File metadata and controls
70 lines (65 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# datax template
def put_config(sour_ip,sour_port,sour_user,sour_passwd,tar_ip,tar_port,tar_user,tar_passwd,preSql,db_name,table_name):
sour_db_connect = sour_ip + ':' + sour_port
tar_db_connect = tar_ip + ':' + tar_port
config_text = f"""
{{"job": {{
"setting": {{
"speed": {{
"channel": 10,
"byte": -1,
"record": -1,
}}
}},
"content": [
{{
"reader": {{
"name": "mysqlreader",
"parameter": {{
"username": "{sour_user}",
"password": "{sour_passwd}",
"column":["*"],
"splitPk": "",
"connection": [
{{
"table": [
"{table_name}"
],
"jdbcUrl": [
"jdbc:mysql://{sour_db_connect}/{db_name}"
]
}}
]
}}
}},
"writer": {{
"name": "mysqlwriter",
"parameter": {{
"writeMode": "insert",
"username": "{tar_user}",
"password": "{tar_passwd}",
"column": [
"*"
],
"session": [
"set session sql_mode='ANSI'"
],
"preSql": [
"{preSql}"
],
"connection": [
{{
"jdbcUrl": "jdbc:mysql://{tar_db_connect}/{db_name}",
"table": [
"{table_name}"
]
}}
]
}}
}}
}}
]
}}
}}
"""
return config_text