-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path数据计算yaml.yaml
46 lines (43 loc) · 1.63 KB
/
数据计算yaml.yaml
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
input:
label: interval
generate:
interval: "0s"
count: 1
mapping: root = {}
pipeline:
processors:
- branch:
processors:
- sql_raw:
args_mapping: "[0]"
driver: postgres
dsn: postgres://postgres:123456@172.21.222.10:5432/postgres?sslmode=disable
query: SELECT
id,materialId,changeType,oldData,newData,changeReason,changeedBy,changeTimestamp,version,isDetele
FROM public.materialalter where 1 = $1 or id in('88','84','78')
result_map: root.database0 = this
- label: datacomputed
mapping: >
root = this
root.datacomputed = this.database0.map_each(item -> item.assign({ "res": if [item."id", item."isDetele"].contains(null) { null } else { (item."id".number() + item."isDetele".number()) } }))
output:
sql_raw:
unsafe_dynamic_query: false
driver: postgres
dsn: postgres://postgres:123456@172.21.222.10:5432/postgres?sslmode=disable
init_statement: >-
CREATE TABLE IF NOT EXISTS ioit2.testtttttttt (
status int,
name varchar NOT NULL );
COMMENT ON COLUMN ioit2.testtttttttt.status IS '';
COMMENT ON COLUMN ioit2.testtttttttt.name IS '';
query: "INSERT INTO ioit2.testtttttttt (status,name) VALUES ($1,$2),($3,$4),($5,$6);"
args_mapping: |
root = [
this.datacomputed.index(0).res,
this.datacomputed.index(0).changeedby,
this.datacomputed.index(1).res,
this.datacomputed.index(1).changeedby,
this.datacomputed.index(2).res,
this.datacomputed.index(2).changeedby
]