Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra selective copy

I want to copy selected rows from a columnfamily to a .csv file. The copy command is available just to dump a column or entire table to a file without where clause. Is there a way to use where clause in copy command?

Another way I thought of was,

Do "Insert into table2 () values ( select * from table1 where <where_clause>);" and then dump the table2 to .csv , which is also not possible.

Any help would be much appreciated.

like image 413
Dhamodaran Avatar asked Aug 26 '13 20:08

Dhamodaran


1 Answers

There are no way to make a where clause in copy, but you can use this method :

echo "select c1,c2.... FROM keySpace.Table where ;" | bin/cqlsh > output.csv

It allows you to save your result in the output.csv file.

like image 198
Amine CHERIFI Avatar answered Sep 22 '22 21:09

Amine CHERIFI