Are event_time and timestamp essentially representing the same datetime? On Sunday, August 31, 2014, Subodh Nijsure <subodh.nijs...@gmail.com> wrote:
> I have following database schema > > CREATE TABLE sensor_info_table ( > asset_id text, > event_time timestamp, > "timestamp" timeuuid, > sensor_reading map<text, text>, > sensor_serial_number text, > sensor_type int, > PRIMARY KEY ((asset_id), event_time, "timestamp") > ); > > CREATE INDEX event_time_index ON sensor_info_table (event_time); > > CREATE INDEX timestamp_index ON sensor_info_table ("timestamp"); > > Now I am able to insert the data into this table, however I am unable > to do following query where I want to select items with specific > timeuuid values. > > It gives me following error. > > SELECT * from mydb.sensor_info_table where timestamp IN ( > bfdfa614-3166-11e4-a61d-b888e30f5d17 , > bf4521ac-3166-11e4-87a3-b888e30f5d17) ; > > Bad Request: PRIMARY KEY column "timestamp" cannot be restricted > (preceding column "event_time" is either not restricted or by a non-EQ > relation) > > What do I have to do to make this work? > > For what its worth I am using django for my front end development and > I am using "timestamp timeuuid" field as unique indentifier to > reference specific sensor reading from django framework -- since > cassandra doesn't have way to generate unique id upon insert (like > old-style rdms's auto-fields). > > > Below is software version info. > > show VERSION ; [cqlsh 4.1.1 | Cassandra 2.0.9 | CQL spec 3.1.1 | > Thrift protocol 19.39.0] > > I really don't understand what the error message preceeding column > "event_time" is either not restricted or by no-EQ relation? > > -Subodh Nijsure >