-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy path2-create-error-file.sql
51 lines (37 loc) · 1.24 KB
/
2-create-error-file.sql
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
-- Description:
-- In this example we show how you can manage file
-- orchestration using Luminesce. If a response/table
-- has errors, we move the file to an "error" directory.
-- If the response/table has no errors, we move the file to
-- a "processed" directory
@@fileName = select 'instruments_error.csv';
@@fileNameNoExtension = select substr(@@fileName, 1, length(@@fileName)-4);
@@newDirectory = select 'luminesce-examples/orchestration/new';
/*
==============================================
1. Create success file for testing
==============================================
NOTE:
Run either 1A or 1B
1A uses a file with no errors
1B uses a file with errors
*/
@instrumentsResponse = select
'BondA' as 'InstrumentId',
0 as WriteErrorCode -- success
union all
values
('BondB', 102),
('BondC', 102),
('BondD', 103);
/*
==============================================
2. Save new file to Drive
==============================================
*/
@saveFilesToDrive = use Drive.SaveAs with @instrumentsResponse, @@newDirectory, @@fileNameNoExtension
--path=/{@@newDirectory}
--ignoreOnZeroRows=true
--fileNames={@@fileNameNoExtension}
enduse;
select * from @saveFilesToDrive;