I want to add secondary index of type timestamp, in order to be able to query by timestamp range without 'ALLOW FILTERING'.
I can't use timeuuid, because the timestamp is different than now(). I have datetime which I should convert into timestamp.
I want to query by time, for example:
session.execute("SELECT id from my_table WHERE date>'2019-09-01' AND date<'2019-09-04'").
Any suggestions of what is the right way of doing it? or how can I use timuuid from python with an input of the datetime? (convert datetime to uuid field)
Thanks.
my_table = session.execute(""" CREATE TABLE IF NOT EXISTS my_keyspace.my_table
(id text,
date timestamp,
PRIMARY KEY (id)
)""")
session.execute("CREATE INDEX time_idx ON my_keyspace.my_table (date)""")