Skip to content

Instantly share code, notes, and snippets.

@informz
Last active October 2, 2017 16:42
Show Gist options
  • Save informz/52309e0dc0946ddb7021fb15792d7666 to your computer and use it in GitHub Desktop.
Save informz/52309e0dc0946ddb7021fb15792d7666 to your computer and use it in GitHub Desktop.
Data Lake Config Proposal using EAV pattern
insert API request:
[
{
"entity" : "ssp_ratecard",
"attribute" : "calendar_period_id",
"bigint_value" : 34567,
"text_value" : null,
"double_value" : null,
"boolean_value" : null
}
]
insert API response:
[
{
"entity" : "ssp_ratecard",
"attribute" : "calendar_period_id",
"identity" : "f1b62db0-a775-11e7-976d-7f5b19983056",
"bigint_value" : 34567,
"text_value" : null,
"double_value" : null,
"boolean_value" : null,
"parent_identity" : null,
"updated_date" : "2017-10-02 13:31:06+0000"
}
]
create table IF NOT EXISTS data_lake.lake_config
( entity text,
attribute text,
identity timeuuid,
bigint_value bigint,
text_value text,
double_value double,
boolean_value boolean,
parent_identity timeuuid,
updated_date timestamp,
PRIMARY KEY (entity, attribute, identity)
);
insert into data_lake.lake_config ( entity, attribute,identity, bigint_value, updated_date) values ( 'ssp_ratecard', 'division_id',now(), 12345, toTimestamp(now()));
insert into data_lake.lake_config (entity, attribute,identity, bigint_value, updated_date, parent_identity) values ('ssp_ratecard', 'ratecard_id', now(),23456, toTimestamp(now()), 85d6ab65-a775-11e7-976d-7f5b19983056);
insert into data_lake.lake_config (entity, attribute,identity, bigint_value, updated_date, parent_identity) values ('ssp_ratecard', 'calendar_period_id', now(),34567, toTimestamp(now()), c9db63ab-a775-11e7-a337-df2ec9ca83ae);
insert into data_lake.lake_config (entity, attribute,identity, bigint_value, updated_date, parent_identity) values ('ssp_ratecard', 'rating_stream_code', now(),45678, toTimestamp(now()), f1b62db0-a775-11e7-976d-7f5b19983056);
select * from data_lake.lake_config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment