Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
7.5 kB
3
Indexable
Never
now using above paramaters which i have guven create me an api as above for my cassandra table in which my table has multiple materialized views
CREATE TABLE hobs_ods_staging.hos_cart_details (
    hoscd_event_date date,
    hoscd_businessid text,
    hoscd_key text,
    hoscd_buid text,
    hoscd_createdtime timestamp,
    hoscd_opid text,
    hoscd_status text,
    hoscd_type text,
    hoscd_updatedtime timestamp,
    hoscd_username text,
    hoscd_value blob,
    hoscd_valuetype text,
    PRIMARY KEY (hoscd_event_date, hoscd_businessid, hoscd_key)
) WITH CLUSTERING ORDER BY (hoscd_businessid ASC, hoscd_key ASC)
    AND additional_write_policy = '99p'
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
    AND cdc = false
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.DateTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND memtable = 'default'
    AND crc_check_chance = 1.0
    AND default_time_to_live = 0
    AND extensions = {}
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair = 'BLOCKING'
    AND speculative_retry = '99p';


the above tables is the main table create model class for above and in get api function and get all the hoscd_event_date from given date like the parameter eventdate will be passed in url


CREATE MATERIALIZED VIEW hobs_ods_staging.hos_cart_details_by_businessid_status AS
    SELECT hoscd_businessid, hoscd_status, hoscd_event_date, hoscd_key, hoscd_buid, hoscd_createdtime, hoscd_opid, hoscd_type, hoscd_updatedtime, hoscd_username, hoscd_value, hoscd_valuetype
    FROM hobs_ods_staging.hos_cart_details
    WHERE hoscd_businessid IS NOT NULL AND hoscd_event_date IS NOT NULL AND hoscd_key IS NOT NULL AND hoscd_status IS NOT NULL
    PRIMARY KEY ((hoscd_businessid, hoscd_status), hoscd_event_date, hoscd_key)
 WITH CLUSTERING ORDER BY (hoscd_event_date ASC, hoscd_key ASC)
    AND additional_write_policy = '99p'
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
    AND cdc = false
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND memtable = 'default'
    AND crc_check_chance = 1.0
    AND extensions = {}
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair = 'BLOCKING'
    AND speculative_retry = '99p';


the above tables is the materialized view of main table from above table create model class and  get me the hoscd_businessid and hoscd_status.the parameter will be businessid and status



CREATE MATERIALIZED VIEW hobs_ods_staging.hos_cart_details_by_businessid AS
    SELECT hoscd_businessid, hoscd_event_date, hoscd_key, hoscd_buid, hoscd_createdtime, hoscd_opid, hoscd_status, hoscd_type, hoscd_updatedtime, hoscd_username, hoscd_value, hoscd_valuetype
    FROM hobs_ods_staging.hos_cart_details
    WHERE hoscd_businessid IS NOT NULL AND hoscd_event_date IS NOT NULL AND hoscd_key IS NOT NULL
    PRIMARY KEY (hoscd_businessid, hoscd_event_date, hoscd_key)
 WITH CLUSTERING ORDER BY (hoscd_event_date ASC, hoscd_key ASC)
    AND additional_write_policy = '99p'
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
    AND cdc = false
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND memtable = 'default'
    AND crc_check_chance = 1.0
    AND extensions = {}
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair = 'BLOCKING'
    AND speculative_retry = '99p';


the above tables is the materialized view of main table from above table create model class and  get me the hoscd_businessid .the parameter will be businessid 




CREATE MATERIALIZED VIEW hobs_ods_staging.hos_cart_details_by_status AS
    SELECT hoscd_status, hoscd_businessid, hoscd_event_date, hoscd_key, hoscd_buid, hoscd_createdtime, hoscd_opid, hoscd_type, hoscd_updatedtime, hoscd_username, hoscd_value, hoscd_valuetype
    FROM hobs_ods_staging.hos_cart_details
    WHERE hoscd_businessid IS NOT NULL AND hoscd_event_date IS NOT NULL AND hoscd_key IS NOT NULL AND hoscd_status IS NOT NULL
    PRIMARY KEY (hoscd_status, hoscd_businessid, hoscd_event_date, hoscd_key)
 WITH CLUSTERING ORDER BY (hoscd_businessid ASC, hoscd_event_date ASC, hoscd_key ASC)
    AND additional_write_policy = '99p'
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
    AND cdc = false
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND memtable = 'default'
    AND crc_check_chance = 1.0
    AND extensions = {}
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair = 'BLOCKING'
    AND speculative_retry = '99p';


the above tables is the materialized view of main table from above table create model class and  get me the hoscd_status .the parameter will be status


CREATE MATERIALIZED VIEW hobs_ods_staging.hos_cart_details_by_username AS
    SELECT hoscd_username, hoscd_businessid, hoscd_event_date, hoscd_key, hoscd_buid, hoscd_createdtime, hoscd_opid, hoscd_status, hoscd_type, hoscd_updatedtime, hoscd_value, hoscd_valuetype
    FROM hobs_ods_staging.hos_cart_details
    WHERE hoscd_businessid IS NOT NULL AND hoscd_event_date IS NOT NULL AND hoscd_key IS NOT NULL AND hoscd_username IS NOT NULL
    PRIMARY KEY (hoscd_username, hoscd_businessid, hoscd_event_date, hoscd_key)
 WITH CLUSTERING ORDER BY (hoscd_businessid ASC, hoscd_event_date ASC, hoscd_key ASC)
    AND additional_write_policy = '99p'
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
    AND cdc = false
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND memtable = 'default'
    AND crc_check_chance = 1.0
    AND extensions = {}
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair = 'BLOCKING'
    AND speculative_retry = '99p';


the above tables is the materialized view of main table from above table create model class and  get me the hoscd_username .the parameter will be username