cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakub Narloch <>
Subject Re: Cassandra 3.4 Triggers API
Date Mon, 25 Jul 2016 19:14:34 GMT
Hi Siddharth,

Thank you for answer.

Yes this is exactly the same goal that I wish to accomplish, though I was
wondering whether it would be possible to access the data of the row that
is being inserted so that I would be able to take a snapshot of the entire
row. Does anybody knows if that is really impossible?

So to sum up I have a single table that I wish to audit for any of the
changes. The table partition key consists of three columns that uniquely
identify the row.

table data (
 composite_key1 TEXT,
 composite_key2 TEXT,
 composite_key3 TEXT,

 PRIMARY KEY(composite_key1, composite_key2, composite_key3)

What I wish to do is extract the those three columns through trigger and
insert those into a audit table which is going to have a aggregating
partition key as well as clustering timeuuid. Something similar to

table audit_table (
   timestamp_aggregate long,
   timestamp timeuuid,

   composite_key1 TEXT,
   composite_key2 TEXT,
   composite_key3 TEXT

   PRIMARY KEY(timestamp_aggregate, timestamp)

Could you share any code snippet on how exactly you manage to extract the
partition keys columns?

Jakub Narloch

2016-07-25 17:48 GMT+02:00 Siddharth Verma <>:

> Hi Jakub,
> I worked with trigger, I was auditing it by time
> .
> I considered the following partition keys for the audit table.
> 1. (timeuuid,uuid) OR,
> 2. formatted date in groups of 5 minutes
> 21 March 2015, 13:44:15 -> 201503211340
> *Used it to batch operations by a group of minutes.*
> *Caution : If you have extremely heavy write/update work load, it may
> cause to create wide rows.*
> Your second point isn't clear.
> If you want the values of non primary key columns to be audited, as is
> done with triggers in MySQL, unfortunately, as far as I know, this can't be
> done.
> However for the values of partition key, clustering column, on which the
> update,insert,delete is called,
> this can be extracted by using the UnfilteredRowIterator of the Partition
> object you receive in the trigger function.
> Thanks and Regards,
> Siddharth Verma

View raw message