Is there any good example or guide on how to implement a Cassandra trigger step-by-step?
I'm looking for something advanced, like manipulating other rows in same partition after an INSERT or UPDATE is performed.
Unfortunately the documentation is very limited, I only found these links so far:
Example
Let's say you want to put logs into a table and aggregate them whenever you reach a certain number of log entries.
CREATE TABLE simple_log (
id int,
event_id timeuuid,
message text,
PRIMARY KEY(id)
);
INSERT INTO simple_log (id, event_id, message) VALUES (1, now(), 'first');
INSERT INTO simple_log (id, event_id, message) VALUES (1, now(), 'second');
INSERT INTO simple_log (id, event_id, message) VALUES (1, now(), 'third');
Whenever you select top the logs by ID, you should get back an aggregated result:
SELECT * FROM simple_log WHERE id = 1;
id | event_id | message
----+--------------------------------------+---------
1 | d97f92d1-b5a4-11e7-825c-495e6ea8608a | first-second-third