Reputation: 53
I want to copy only selective rows and columns from a specific Cassandra table. How do I that?
I am able to copy complete tables in .csv format with the help of:https://docs.datastax.com/en/cql/3.1/cql/cql_reference/copy_r.html
But, how do I copy selective data only?
I tried referencing: Selective copy cassandra million rows data to external file AND Cassandra selective copy . But none of them work.
Upvotes: 0
Views: 2594
Reputation: 331
You can specify which columns you would like to update. Say, if you 10 different columns but you want to copy only 3 of them then you specify like this
COPY products (name, id, color) from 'products.csv';
The only constraint over here is the CSV files should contain the only 3 columns. I'd suggest you to make a copy of csv file and refactor it. You can easily do it in python using csv library.
Upvotes: 0
Reputation: 810
There is no built-in support for selective copy. You could either export the whole bunch of data and do filtering on the client side or use some Map-Reduce (or Spark) job otherwise to extract the data you need.
Upvotes: 0