Monthly Archives: March 2016

Cassandra set the writetime explicitly with a PreparedStatement

This is a quick one, I wanted to set the writetime of a row explicitly when I populate the database for testing purposes. We use the writetime of a column to filter them out.

It required some looking around to find out how to do this…. so I figured I write an article about it.

The timestamp will be set for ALL cells in this row (well not the primary key, cause it does not have a timestamp, but the others).

The timestamp is given as milliseconds since EPOC, so lots of digits :-).

A prepared statement would then look like this (Scala code)

TTL and TIMESTAMP can both be set like this, i.e. with [ttl] and [timestamp]

-Tobias