-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbank-transactions.studio-nb.tar
38 lines (38 loc) · 10 KB
/
bank-transactions.studio-nb.tar
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
notebook.bin 0100644 0000000 0000000 00000006656 14015040274 012131 0 ustar 00 0000000 0000000 json_notebook_v1 {"1":"b1cc3fd9-fec8-46eb-812e-ff4eb9eaf6c7","10":"4090e2e8-c005-49e8-aeb8-4f1cf04de346","11":"Transactions","12":{"1":1612898445,"2":344000000},"13":{"1":1614035356,"2":652000000},"14":false,"15":[{"1":"de820018-44e4-43fb-9b6d-1a54dd2a1337","11":"CREATE TABLE IF NOT EXISTS bank.transactions (\n account_id text,\n transaction_id text,\n transaction_date timestamp,\n amount double,\n merchant_id text,\n medium text,\n tx_status text,\n description text,\n category text,\n PRIMARY KEY ((account_id), transaction_date)\n ) WITH CLUSTERING ORDER BY (transaction_date DESC);","12":"cql","16":true,"17":false,"24":"bank","25":"LOCAL.QUORUM"},{"1":"cd15f82c-129d-4520-a504-fe77974db495","11":"insert into bank.transactions\n(account_id,transaction_id,transaction_date,amount,merchant_id,medium,tx_status,description,category)\nvalues ('28df63b7-cc57-43cb-9752-fae69d1653da','28df63b7-cc57-43cb-9752-fae69d1653da','2019-12-15 03:42:34',32.0,'Grand Lucky','credit card','COMPLETE','','shopping');\ninsert into bank.transactions\n(account_id,transaction_id,transaction_date,amount,merchant_id,medium,tx_status,description,category)\nvalues ('5752fae6-9d16-43da-b20f-557a1dd5c571','5752fae6-9d16-43da-b20f-557a1dd5c571','2020-04-26 10:32:02',68.0,'Informa','credit card','COMPLETE','','shopping');\ninsert into bank.transactions\n(account_id,transaction_id,transaction_date,amount,merchant_id,medium,tx_status,description,category)\nvalues ('720f557a-1dd5-4571-afb2-0dd47d657943','720f557a-1dd5-4571-afb2-0dd47d657943','2020-06-08 23:16:13',89.0,'HokBen','debit card','COMPLETE','','dining out');","12":"cql","16":true,"17":false,"24":"bank","25":"LOCAL.QUORUM"},{"1":"52a11ac6-62cf-43d7-a344-001dca8ffe85","11":"select * from bank.transactions where account_id = '720f557a-1dd5-4571-afb2-0dd47d657943';","12":"cql","16":true,"17":false,"24":"bank","25":"LOCAL.QUORUM"},{"1":"741a3e70-3822-4fe1-909b-fdb32750d747","11":"select * from bank.transactions where account_id = '76a12069-b0a3-476e-a0b3-edf028f8001f' and transaction_date > '2021-01-01';","12":"cql","16":true,"17":false,"24":"bank","25":"LOCAL.QUORUM"},{"1":"5d2fb6ac-feb0-446c-a95b-5579a809e7b8","11":"CREATE CUSTOM INDEX IF NOT EXISTS transaction_date_sai_idx ON bank.transactions (transaction_date) USING 'StorageAttachedIndex';\nCREATE CUSTOM INDEX IF NOT EXISTS amount_sai_idx ON bank.transactions (amount) USING 'StorageAttachedIndex';\nCREATE CUSTOM INDEX IF NOT EXISTS medium_sai_idx ON bank.transactions (medium) USING 'StorageAttachedIndex' WITH OPTIONS = {'case_sensitive': false, 'normalize': true};\nCREATE CUSTOM INDEX IF NOT EXISTS category_sai_idx ON bank.transactions (category) USING 'StorageAttachedIndex' WITH OPTIONS = {'case_sensitive': false, 'normalize': true};\nCREATE CUSTOM INDEX IF NOT EXISTS status_sai_idx ON bank.transactions (tx_status) USING 'StorageAttachedIndex' WITH OPTIONS = {'case_sensitive': false, 'normalize': true};","12":"cql","16":true,"17":false,"24":"bank","25":"LOCAL.QUORUM"},{"1":"a130dc94-6f27-4885-83ae-2a612fbfc433","11":"select transaction_date, amount, merchant_id, category from bank.transactions where category='dining out' and transaction_date > '2021-02-01';","12":"cql","16":true,"17":false,"24":"bank","25":"LOCAL.QUORUM"}],"16":{"1":{}},"17":"","19":false} code.txt 0100644 0000000 0000000 00000005240 14015040274 011256 0 ustar 00 0000000 0000000 --------------------NOTEBOOK_Transactions--------------------
--------------------CELL_CQL_1--------------------
CREATE TABLE IF NOT EXISTS bank.transactions (
account_id text,
transaction_id text,
transaction_date timestamp,
amount double,
merchant_id text,
medium text,
tx_status text,
description text,
category text,
PRIMARY KEY ((account_id), transaction_date)
) WITH CLUSTERING ORDER BY (transaction_date DESC);
--------------------CELL_CQL_2--------------------
insert into bank.transactions
(account_id,transaction_id,transaction_date,amount,merchant_id,medium,tx_status,description,category)
values ('28df63b7-cc57-43cb-9752-fae69d1653da','28df63b7-cc57-43cb-9752-fae69d1653da','2019-12-15 03:42:34',32.0,'Grand Lucky','credit card','COMPLETE','','shopping');
insert into bank.transactions
(account_id,transaction_id,transaction_date,amount,merchant_id,medium,tx_status,description,category)
values ('5752fae6-9d16-43da-b20f-557a1dd5c571','5752fae6-9d16-43da-b20f-557a1dd5c571','2020-04-26 10:32:02',68.0,'Informa','credit card','COMPLETE','','shopping');
insert into bank.transactions
(account_id,transaction_id,transaction_date,amount,merchant_id,medium,tx_status,description,category)
values ('720f557a-1dd5-4571-afb2-0dd47d657943','720f557a-1dd5-4571-afb2-0dd47d657943','2020-06-08 23:16:13',89.0,'HokBen','debit card','COMPLETE','','dining out');
--------------------CELL_CQL_3--------------------
select * from bank.transactions where account_id = '720f557a-1dd5-4571-afb2-0dd47d657943';
--------------------CELL_CQL_4--------------------
select * from bank.transactions where account_id = '76a12069-b0a3-476e-a0b3-edf028f8001f' and transaction_date > '2021-01-01';
--------------------CELL_CQL_5--------------------
CREATE CUSTOM INDEX IF NOT EXISTS transaction_date_sai_idx ON bank.transactions (transaction_date) USING 'StorageAttachedIndex';
CREATE CUSTOM INDEX IF NOT EXISTS amount_sai_idx ON bank.transactions (amount) USING 'StorageAttachedIndex';
CREATE CUSTOM INDEX IF NOT EXISTS medium_sai_idx ON bank.transactions (medium) USING 'StorageAttachedIndex' WITH OPTIONS = {'case_sensitive': false, 'normalize': true};
CREATE CUSTOM INDEX IF NOT EXISTS category_sai_idx ON bank.transactions (category) USING 'StorageAttachedIndex' WITH OPTIONS = {'case_sensitive': false, 'normalize': true};
CREATE CUSTOM INDEX IF NOT EXISTS status_sai_idx ON bank.transactions (tx_status) USING 'StorageAttachedIndex' WITH OPTIONS = {'case_sensitive': false, 'normalize': true};
--------------------CELL_CQL_6--------------------
select transaction_date, amount, merchant_id, category from bank.transactions where category='dining out' and transaction_date > '2021-02-01';