For my Cassandra Database, I need to set a value in column for all rows in my table.
I see in SQL, we can do :
UPDATE table SET column1= XXX;
but in CQL (in cqlsh), It doesn't work ! I don't want to update row by row until 9500 rows.
Do you have any suggestion ?
Thank you :)
UPDATE writes one or more column values to a row in a Cassandra table. Like INSERT, UPDATE is an upsert operation: if the specified row does not exist, the command creates it. All UPDATEs within the same partition key are applied atomically and in isolation.
Cassandra Create Data INSERT command is used to insert data into the columns of the table. Syntax: INSERT INTO <tablename> (<column1 name>, <column2 name>....)
In Cassandra, to modify a column by executing an ALTER statement. Using ALTER table statement You can change the type of a column, Add a new column, Drop a column, Rename existing column as shown here: ALTER TABLE [keyspace_name.]
The UPDATE SET operation is not valid on a primary key field. Specify other column values using SET. To update multiple columns, separate the name-value pairs using commas.
You can use update query with IN clause instead of executing 9500 query. At first select primary_key from your table and then copy values to this query:
UPDATE table SET column1 = XXX WHERE primary_key IN (p1, p2, p3, ...);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With