Cassandra CQL3 Import CSV

Background:

I created a diagram called AvailableDomains (simple strategy, 1 node).

In this keyspace, I created one family of tables and columns called column domains (id, urn, timestamp, flag). All text of the type, except the timestamp, is a type of time.

I run cassandra,

launch cqlsh -3,

use AvailableDomains,

and then run the following command to insert csv:

COPY domains (id, urn, timestamp, flag) from 'test.csv' where HEADER= TRUE; 

I get an error: Invalid COPY command

Question: What am I doing wrong?

More details:

CSV -

 id,url,timestamp,flag 1,google.com,1375891081,1 2,facebook.com,1375891081,1 3,youtube.com,1375891081,1 4,yahoo.com,1375891081,1 5,baidu.com,1375891081,1 6,wikipedia.org,1375891081,1 7,amazon.com,1375891081,1 8,qq.com,1375891081,1 9,live.com,1375891081,1 10,linkedin.com,1375891081,1 

The csv location is in cassandra / bin (the same directory where cqlsh is located).

OS: Centos 6.4 64bit

+6
source share
1 answer

This is fixed for CQL 3:

 COPY domains FROM 'test.csv' WITH HEADER = true ; 

The reason I use Header = True is the first line of my CSV with column names. Hope this helps someone else.

+9
source

Source: https://habr.com/ru/post/951241/


All Articles