user3385957
user3385957

Reputation: 141

how do i move data from one column into another column in same table with different data type in cassandra

I have a varchar column in a cassandra table which I want to move to a different column with data type as set. What's the best way to do it ? Both columns are in the same table.

Upvotes: 0

Views: 113

Answers (1)

Alex Ott
Alex Ott

Reputation: 87329

You can do it 2 ways:

  1. Use Spark Cassandra connector to perform batch read, transformation of date & write data back - this is very optimal if you have cluster of several machines, because processing could be parallelized;
  2. Write your own code (for example, in Python) that will iterate over the whole ring, read data, transform & write them back. You can use CQL like: select * from ks.table where token(partition_key) > start_range AND token(partition_key) <= end_range), and ranges you can get via Cluster.metadata.ring...

Upvotes: 1

Related Questions