Use a timestamp instead of 2 separate fields and you can query on the range.

CREATE TABLE mytable (
    sensorname text,
    reading_time timestamp,
    data MAP<text, int>,
    PRIMARY KEY (sensorname, reading_time)
);



On Fri, Aug 26, 2016 at 8:17 PM Peter Figliozzi <pete.figlio...@gmail.com>
wrote:

> I have data from many sensors as time-series:
>
>    - Sensor name
>    - Date
>    - Time
>    - value
>
> I want to query windows of both date and time.  For example, 8am - 9am
> from Aug. 1st to Aug 10th.
>
> Here's what I did:
>
> CREATE TABLE mykeyspace.mytable (
>     sensorname text,
>     date date,
>     time time,
>     data MAP<text, int>,
>     PRIMARY KEY (sensorname, date, time)
> );
>
>
> However, when we query this, Cassandra restricts us to an "equal"
> relation for the date, if we are to select a window of time.  So with that
> schema, I'd have to query once for each date.
>
>
> What's the right way to do this??  ("Right" defined as extracting a window
> of date and of time in one query.)
>
>
> Thank you,
>
>
> Pete
>

Reply via email to