Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra: Unable to coerce '2016-04-06 13:06:11.534000' to a formatted date (long)

Tags:

I am trying to UPDATE an existing item in my cassandra DB using cqlsh:

$ > UPDATE allEvents SET "isLastEvent" = True WHERE "websiteId" = 'sd-8231' AND "purchaser" = False AND "currentTime" = '2016-04-06 13:06:11.534000'; 

And I got this:

InvalidRequest: code=2200 [Invalid query] message="Unable to coerce '2016-04-06 13:06:11.534000' to a formatted date (long)"

In case it can help:

$ > show version [cqlsh 5.0.1 | Cassandra 3.0.2 | CQL spec 3.3.1 | Native protocol v4] 
like image 616
farhawa Avatar asked Apr 06 '16 14:04

farhawa


1 Answers

That's because Cassandra timestamp types only support milliseconds. Your currentTime has too much precision. Trim off the last three zeros, and that should work:

UPDATE allEvents SET "isLastEvent" = True  WHERE "websiteId" = 'sd-8231'       AND "purchaser" = False        AND "currentTime" = '2016-04-06 13:06:11.534'; 
like image 177
Aaron Avatar answered Oct 17 '22 07:10

Aaron