-
Notifications
You must be signed in to change notification settings - Fork 2
/
csv2sql.yml
85 lines (76 loc) · 2.5 KB
/
csv2sql.yml
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
path.data: data
path.logs: log
api_bind: 0.0.0.0:2900
modules:
- name: ui
enabled: false
- name: api
enabled: false
plugins:
- name: csv2sql
enabled: true
modules:
- name: pipeline
enabled: true
runners:
- name: process_excel
enabled: true
input_queue: primary
max_go_routine: 1
threshold_in_ms: 0
timeout_in_ms: 5000
default_config:
start:
joint: read_csv
enabled: true
parameters:
file_name: "test/import.xlsx"
process:
- joint: convert_sql
enabled: true
parameters:
sheet_name: fish_information
data_start_from_index: 3
column_name:
- id
- outer_code
- common_name
- scientific_name
- english_name
- chinese_name
- region_name
- aquatic_category_id
- category_name
- is_homemade
- aquatic_region_id
- inner_code
- produce_pattern
- feed_pattern
- catch_pattern
row_format:
- 'INSERT INTO `aquatic_base_info` (`id`, `outer_code`, `common_name`, `scientific_name`, `english_name`, `chinese_name`, `region_name`, `aquatic_category_id`)'
- 'VALUES (<{id: }>, <{outer_code: }>, <{common_name: }>, <{scientific_name: }>, <{english_name: }>, <{chinese_name: }>, <{region_name: }>, <{aquatic_category_id: }>);'
- 'INSERT INTO `aquatic_source` (`inner_code`, `aquatic_base_info_id`, `is_homemade`, `aquatic_region_id`, `produce_pattern`, `feed_pattern`, `catch_pattern`) '
- 'VALUES (<{inner_code: }>, <{id: }>, <{is_homemade: }>, <{aquatic_region_id: }>, <{produce_pattern: }>, <{feed_pattern: }>, <{catch_pattern: }>);'
- joint: convert_sql
enabled: true
parameters:
sheet_name: aquatic_region
data_start_from_index: 1
column_name:
- id
- code
- name
- is_homemade
row_format:
- 'INSERT INTO `aquatic_region` (`id`, `code`, `name`, `is_homemade`) VALUES (<{id: }>, <{code: }>, <{name: }>, <{is_homemade: }>);'
- joint: import_sql
enabled: true
parameters:
mysql_conn: root:qeephp@tcp(localhost:3306)/ifish?charset=utf8
rollback_enabled: true
- joint: logging
enabled: true
error:
joint: on_error
enabled: true