-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathupload-term-deposit-instruments.sql
36 lines (30 loc) · 1.14 KB
/
upload-term-deposit-instruments.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
-- ============================================================
-- Description:
-- 1. In this query, we run an ETL process on some instruments.
-- 2. First, we load a Excel file of instruments from Drive.
-- 3. Next, we transform the shape of the instrument data.
-- 4. Finally we upload the instrument data into LUSID.
-- ============================================================
-- Extract Term Deposit data from LUSID Drive
@term_deposit_file = use Drive.Excel
--file=/luminesce-examples/instruments.xlsx
--worksheet=term_deposits
enduse;
-- Transform data using SQL
@term_deposit_instruments = select
id as ClientInternal,
name as DisplayName,
start_date as StartDate,
mat_date as MaturityDate,
rate as Rate,
payment_freq as FlowConventionPaymentFrequency,
day_count_convention as FlowConventionDayCountConvention,
flow_convention as FlowConventionRollConvention,
payment_cals as FlowConventionPaymentCalendars,
reset_cals as FlowConventionResetCalendars,
currency as FlowConventionCurrency
from @term_deposit_file;
-- Upload the transformed data into LUSID
select *
from Lusid.Instrument.TermDeposit.Writer
where ToWrite = @term_deposit_instruments;