-
Notifications
You must be signed in to change notification settings - Fork 0
/
workflowsData Update: GENERIC: Process Alter Statements.json
332 lines (332 loc) · 9.06 KB
/
workflowsData Update: GENERIC: Process Alter Statements.json
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
{
"active": false,
"connections": {
"Postgres7": {
"main": [
[
{
"node": "Split In Batches",
"type": "main",
"index": 0
}
]
]
},
"Set1": {
"main": [
[
{
"node": "Item Lists",
"type": "main",
"index": 0
}
]
]
},
"Split In Batches": {
"main": [
[
{
"node": "Postgres7",
"type": "main",
"index": 0
}
],
[
{
"node": "Postgreify all column names",
"type": "main",
"index": 0
}
]
]
},
"Execute Workflow Trigger": {
"main": [
[
{
"node": "Set1",
"type": "main",
"index": 0
}
]
]
},
"Postgres3": {
"main": [
[
{
"node": "IF",
"type": "main",
"index": 0
}
]
]
},
"Postgreify all column names": {
"main": [
[
{
"node": "Postgres3",
"type": "main",
"index": 0
}
]
]
},
"IF": {
"main": [
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
],
[
{
"node": "Postgres4",
"type": "main",
"index": 0
}
]
]
},
"Item Lists": {
"main": [
[
{
"node": "Split In Batches",
"type": "main",
"index": 0
}
]
]
}
},
"createdAt": "2023-08-10T13:01:15.525Z",
"id": "Vc6ZgR8vArPNZu09",
"name": "Data Update: GENERIC: Process Alter Statements",
"nodes": [
{
"parameters": {
"operation": "executeQuery",
"query": "{{\"ALTER TABLE upload_\" + $json.supplier.toLowerCase() + \" \" + $json.alterStatements +\";\" }}",
"options": {
"queryBatching": "single"
}
},
"id": "a00e846a-2014-4ee5-b95f-520a1b0d6cba",
"name": "Postgres7",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
1960,
320
],
"credentials": {
"postgres": {
"id": "dqel3RyoT6NsGiSw",
"name": "odooData"
}
}
},
{
"parameters": {
"values": {
"string": [
{
"name": "alterStatements",
"value": "={{ $json.alterStatements.split(', ') }}"
}
]
},
"options": {}
},
"id": "d03bc110-cfa1-40dc-84a6-bfecf4eaf374",
"name": "Set1",
"type": "n8n-nodes-base.set",
"typeVersion": 2,
"position": [
1340,
320
]
},
{
"parameters": {
"batchSize": 1,
"options": {}
},
"id": "49c5aea9-ebfa-42ec-bda6-19be422badf0",
"name": "Split In Batches",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 2,
"position": [
1740,
320
]
},
{
"parameters": {},
"id": "4ba6584c-d7d3-43f7-aaa6-c70d9e0e284f",
"name": "Execute Workflow Trigger",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"typeVersion": 1,
"position": [
1120,
320
]
},
{
"parameters": {},
"id": "bb66ab87-2c77-4c02-946b-c1e7e6e37564",
"name": "Postgreify all column names",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
1340,
560
],
"executeOnce": true
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT column_name, data_type\nFROM information_schema.columns\nWHERE table_schema = 'odoodata' AND table_name = {{\"'upload_\"+ $(\"Execute Workflow Trigger\").first().json.supplier.toLowerCase()+\"'\"}};",
"options": {}
},
"id": "3400d3ce-7830-47b6-bec7-87ca918c2e72",
"name": "Postgres3",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
1520,
560
],
"credentials": {
"postgres": {
"id": "dqel3RyoT6NsGiSw",
"name": "odooData"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "ALTER TABLE {{\"upload_\"+ $(\"Execute Workflow Trigger\").first().json.supplier.toLowerCase()}}\nRENAME COLUMN {{ \"\\\"\"+$json.column_name+\"\\\"\" }} TO {{ $json.column_name.toLowerCase().replace(/\\s/g,'') }};",
"options": {
"queryBatching": "single"
}
},
"id": "e06ed251-f6d6-41cf-9470-b947ea87cdd8",
"name": "Postgres4",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
1740,
780
],
"credentials": {
"postgres": {
"id": "dqel3RyoT6NsGiSw",
"name": "odooData"
}
}
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.column_name }}",
"value2": "={{ $json.column_name.toLowerCase().replace(/\\s/g,'') }}"
}
]
}
},
"id": "d8a9772c-6cb3-4a00-be75-a11db06827cd",
"name": "IF",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1740,
560
]
},
{
"parameters": {},
"id": "5ad893fd-3421-4c70-b738-95189bfcd66a",
"name": "No Operation, do nothing",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
1960,
560
]
},
{
"parameters": {
"fieldToSplitOut": "alterStatements",
"include": "allOtherFields",
"options": {}
},
"id": "c5bc34b0-7a1f-45c4-ab72-90a3852af9b2",
"name": "Item Lists",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 2.2,
"position": [
1520,
320
]
}
],
"pinData": {
"Execute Workflow Trigger": [
{
"json": {
"alterStatements": "RENAME COLUMN \"Vendor SKU\" TO \"ProductCode\", ALTER COLUMN \"ProductCode\" TYPE CHAR(40), RENAME COLUMN \"Product Name\" TO \"ProductName\", ALTER COLUMN \"ProductName\" TYPE CHAR(235), RENAME COLUMN \"UPC/EAN\" TO \"Ean\", ALTER COLUMN \"Ean\" TYPE CHAR(22), RENAME COLUMN \"Unit MSRP\" TO \"Rrp\", ALTER COLUMN \"Rrp\" TYPE DECIMAL(7,2) USING \"Rrp\"::NUMERIC, RENAME COLUMN \"Pack Qty\" TO \"PackQty\", ALTER COLUMN \"PackQty\" TYPE CHAR(27), RENAME COLUMN \"Variant Grouping\" TO \"VariantGrouping\", ALTER COLUMN \"VariantGrouping\" TYPE CHAR(30), RENAME COLUMN \"Short Description\" TO \"ShortDescription\", ALTER COLUMN \"ShortDescription\" TYPE CHAR(222), RENAME COLUMN \"Long Description\" TO \"LongDescription\", ALTER COLUMN \"LongDescription\" TYPE TEXT, RENAME COLUMN \"Unit Cost\" TO \"YourPrice\", ALTER COLUMN \"YourPrice\" TYPE DECIMAL(7,2) USING \"YourPrice\"::NUMERIC, RENAME COLUMN \"Lead Time\" TO \"LeadTime\", ALTER COLUMN \"LeadTime\" TYPE SMALLINT USING \"LeadTime\"::NUMERIC, RENAME COLUMN \"Sub Category\" TO \"SubCategory\", ALTER COLUMN \"SubCategory\" TYPE CHAR(30), RENAME COLUMN \"image\" TO \"ImageUrl\", ALTER COLUMN \"ImageUrl\" TYPE CHAR(102), RENAME COLUMN \"Alternative Image 1\" TO \"AlternativeImage1Url\", ALTER COLUMN \"AlternativeImage1Url\" TYPE CHAR(102), RENAME COLUMN \"Alternative Image 2\" TO \"AlternativeImage2Url\", ALTER COLUMN \"AlternativeImage2Url\" TYPE CHAR(102), RENAME COLUMN \"Alternative Image 3\" TO \"AlternativeImage3Url\", ALTER COLUMN \"AlternativeImage3Url\" TYPE CHAR(102), RENAME COLUMN \"Stock Count\" TO \"StockCount\", ALTER COLUMN \"StockCount\" TYPE SMALLINT USING \"StockCount\"::NUMERIC, RENAME COLUMN \"Technical Spec\" TO \"TechnicalSpec\", ALTER COLUMN \"TechnicalSpec\" TYPE TEXT, ADD COLUMN \"TechnicalSpecLabel\" TEXT DEFAULT NULL",
"supplier": "Silverfish"
}
}
]
},
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"tags": [
{
"id": "4S5wvtegUIvgvqYs",
"createdAt": "2023-08-08T15:46:20.698Z",
"updatedAt": "2023-08-08T15:46:20.698Z",
"name": "PostgreSQL"
},
{
"id": "9sOXgdnAKkDHmBZQ",
"createdAt": "2023-08-10T13:01:44.729Z",
"updatedAt": "2023-08-10T13:01:44.729Z",
"name": "if"
},
{
"id": "bbI8zuoQ3XV0LUP0",
"createdAt": "2023-08-08T15:13:33.587Z",
"updatedAt": "2023-08-08T15:13:33.587Z",
"name": "set"
},
{
"id": "cEh6fwE32oIO00B5",
"createdAt": "2023-08-10T13:01:36.942Z",
"updatedAt": "2023-08-10T13:01:36.942Z",
"name": "split in batches"
},
{
"id": "zZDHTHLWDuph4zmi",
"createdAt": "2023-08-10T13:01:31.941Z",
"updatedAt": "2023-08-10T13:01:31.941Z",
"name": "item lists"
}
],
"triggerCount": 0,
"updatedAt": "2023-08-10T13:02:21.000Z",
"versionId": "f71e10ec-b8fa-4438-a4b1-79cf6a74df5b"
}