There are literary no tutorials on how to update tuples on Google. Can someone explain how tuples can be updated in Cassandra?
There are literary no tutorials on how to update tuples on Google. Can someone explain how tuples can be updated in Cassandra?
The CQL tuple data type is implicitly "frozen" without needing the CQL frozen keyword so you can't update individual elements of a tuple column -- you need to update the whole column.
To illustrate, here's my example CQL table:
CREATE TABLE sensors (
id text PRIMARY KEY,
location tuple<decimal, decimal>,
temperature decimal,
weight int
)
Here's an example where I insert a sensor with its location:
INSERT INTO sensors (id, location)
VALUES ('abc123', (50.4501, 30.5234));
Here's an example where I update the location of a sensor:
UPDATE sensors
SET location = (47.0971, 37.5434)
WHERE id = 'abc123';
For details, see CQL tuple type. Cheers!