2
votes

I have created the following table, but now want to insert the data in things list which i could not because CQL want me to specify the Event time. I dont have that but yes I have OrderId .

What's best way to handle this situation ?

CREATE TABLE "Orders_By_Time" (OrderId text, EventTime timestamp, ThingsList list, PRIMARY KEY (OrderId, EventTime) ) WITH CLUSTERING ORDER BY (EventTime DESC);

Thanks,

1

1 Answers

3
votes

When you insert data you need to specify all parts of the primary key, so you can use dateof(now()) to generate a timestamp for the current time.

See this similar question:

How to get current timestamp with CQL while using Command Line?