Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Trying to find a way to easily transfer all the rows from a Cassandra ColumnFamily/Table to another.

The COPY command, as I understand, is a good option. However, as it dumps all the data to .csv on disk and then loads it back, I can't help but wonder if there is a better way to do it in-engine.

A specific example of what I mean would be the INSERT * FROM my_table INTO my_other_table available in many SQL databases. Of course, I realize that Cassandra is NoSQL and therefore does not to work the same way - but it seems like something which might be available.

What is a good way to accomplish this?

Thanks very much!

share|improve this question

2 Answers 2

cqlsh -k mykeyspace -e 'COPY fromTable(columnNames) TO STDOUT' | head -n -1 | 
cqlsh -k mykeyspace -e 'COPY toTable(columnNames) FROM STDIN'
share|improve this answer
    
Thanks, this looks interesting. However, I'd be concerned about character escaping and other issues, especially when dealing with certain types of data. Is that a concern at all? –  Juan Carlos Coto Aug 19 at 19:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.