Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
2.8 kB
1
Indexable
Never
for above code i used below table for model class to get the data

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';


and also for username i have created materialized view
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';


now i want to create same model class and get the data for username use above materialized view