-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
example.dig
204 lines (183 loc) · 3.52 KB
/
example.dig
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
_export:
plugin:
repositories:
- file://${repos}
# - https://jitpack.io
dependencies:
- pro.civitaspo:digdag-operator-athena:0.4.0
athena:
auth_method: profile
value: 5
+step1:
athena.query>: template.sql
+step2:
echo>: ${athena}
+step3:
athena.preview>: ${athena.last_query.id}
+stap4:
athena.ctas>: template.sql
database: ${database}
table: hoge
location: ${output}/
+step5:
echo>: ${athena}
+step6:
athena.drop_table>:
database: ${database}
table: hoge
with_location: true
+step7:
athena.ctas>: select 1 as a, 2 as b, 3 as c union all select 4 as a, 5 as b, 6 as c
database: ${database}
table: hoge
location: ${output}
partitioned_by: [b, c]
+step8:
athena.drop_partition>:
database: ${database}
table: hoge
partition_kv:
b: "5"
c: "6"
+step9:
athena.add_partition>:
database: ${database}
table: hoge
partition_kv:
b: "5"
c: "6"
+step10:
athena.add_partition>:
database: ${database}
table: hoge
partition_kv:
b: "5"
c: "6"
+step11:
athena.add_partition>:
database: ${database}
table: hoge
partition_kv:
b: "5"
c: "6"
location: ${output}/hoge/fuga/hogo/
+step12:
athena.drop_partition>:
database: ${database}
table: hoge
with_location: true
partition_kv:
b: "2"
c: "3"
+step13:
athena.apas>: select 5 as a
database: ${database}
table: hoge
partition_kv:
b: "9"
c: "10"
save_mode: overwrite
+step14:
+step1:
athena.partition_exists?>:
database: ${database}
table: hoge
with_location: true
partition_kv:
b: "9"
c: "10"
+step2:
echo>: ${athena.last_partition_exists}
+step3:
athena.partition_exists?>:
database: ${database}
table: hoge
partition_kv:
b: "9"
c: "10"
+step4:
echo>: ${athena.last_partition_exists}
+step15:
loop>: 10
_parallel: true
_do:
athena.ctas>: template.sql
database: ${database}
table: hoge_${i}
location: ${output}/hoge_${i}/
save_mode: overwrite
+step16:
+step1:
athena.table_exists?>:
database: ${database}
table: hoge_1
with_location: true
+step2:
echo>: ${athena.last_table_exists}
+step3:
athena.table_exists?>:
database: ${database}
table: hoge
+step4:
echo>: ${athena.last_table_exists}
+step17:
+step1:
athena.drop_table_multi>:
database: ${database}
regexp: 'hoge_\d+'
with_location: true
limit: 3
+step2:
athena.drop_table_multi>:
database: ${database}
regexp: 'hoge_\d+'
with_location: true
protect:
created_within: 1h
+step18:
athena.drop_table_multi>:
database: ${database}
regexp: 'hoge_\d+'
with_location: true
+step19:
+step1:
athena.table_exists?>:
database: ${database}
table: hoge_1
with_location: true
+step2:
echo>: ${athena.last_table_exists}
+step3:
athena.table_exists?>:
database: ${database}
table: hoge
+step4:
echo>: ${athena.last_table_exists}
+step20:
+step1:
athena.partition_exists?>:
database: ${database}
table: hoge_1
with_location: true
partition_kv:
b: "9"
c: "10"
+step2:
echo>: ${athena.last_partition_exists}
+step3:
athena.partition_exists?>:
database: ${database}
table: hoge_1
partition_kv:
b: "9"
c: "10"
+step4:
echo>: ${athena.last_partition_exists}
+step21:
athena.each_database>:
parallel_slice: 8
_do:
+echo1:
echo>: ${athena.each_database}
+echo2:
echo>: ${athena.each_database.name}