I understand that this is not possible using an UPDATE.
What I would like to do instead, is migrate all rows with say PK=0 to new rows where PK=1. Are there any simple ways of achieving this?
I understand that this is not possible using an UPDATE.
What I would like to do instead, is migrate all rows with say PK=0 to new rows where PK=1. Are there any simple ways of achieving this?
For a relatively simple way, you could always do a quick
COPY
TO/FROM in cqlsh.Let's say that I have a column family (table) called "emp" for employees.
And for the purposes of this example, I have one row in it.
If I want to re-create Angel with a new id, I can
COPY
the table's contentsTO
a .csv file:Now, I'll use my favorite editor to change the id of Angel to 2 in emp.csv. Note, that if you have multiple rows in your file (that don't need to be updated) this is your opportunity to remove them:
I'll save the file, and then
COPY
the updated row back into CassandraFROM
the file:Now Angel has two rows in the "emp" table.
For more information, check the DataStax doc on COPY.