The COPY command delivered with cqlsh is a powerful tool that allows you to quickly export and import data. Let's assume that I wanted to duplicate my customer table data into another query table. I'll start by creating the new table:
CREATE TABLE customer_by_company ( last_name text, first_name text, addresses list<frozen<customer_address>>, company text, PRIMARY KEY (company,last_name,first_name));
Next, I will export the contents of my customer table using the COPY TO command:
COPY customer (company,last_name,first_name,addresses) TO '/home/aploetz/Documents/Packt/customer.txt' WITH DELIMITER= '|' AND HEADER=true;Reading options from the command line: {'header': 'true', 'delimiter': '|'}Using 3 child processesStarting copy of packt_ch3.customer ...