Cassandra selective copy

前端 未结 4 1111
轮回少年
轮回少年 2021-01-04 09:10

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

4条回答
  •  时光说笑
    2021-01-04 09:57

    Other ways to run the SQL with filter and redirect the response to csv

    1) Inside the cqlsh, use the CAPTURE command and redirect the output to a file. You need to set the tracing on before executing the command

    Example: CAPTURE 'output.txt' -- output of the sql executed after this command gets captured into output.txt file

    2) In case if you would like to redirect the SQL output to a file from outside of cqlsh

    ./cqlsh -e'select * from keyspaceName.tableName' > fileName.txt -- hostname
    

提交回复
热议问题