Cassandra CQL3导入CSV [英] Cassandra CQL3 Import CSV
问题描述
背景:
我创建了一个名为AvailableDomains(简单策略,1个节点)的模式。
在该键空间中,我创建了1个表/列族,称为具有列(id,urn,timestamp,flag)的域。除时间戳之外的所有类型文本都是类型时间戳。
我启动cassandra,
启动cqlsh -3,
使用AvailableDomains,
,然后发出以下命令以引入csv:
COPY域(id,urn,timestamp,flag)from'test.csv'where HEADER = TRUE;
我收到错误讯息:不当的COPY命令 b
$ b
问题:
我做错了什么?
/ em>
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
csv的位置位于cassandra / bin(cqlsh所在的位置)。
操作系统: Centos 6.4 64位
:
COPY域FROM'test.csv'WITH HEADER = true;
我使用Header = True的原因是我的CSV的第一行有列名。希望这有助于别人在那里。
Background:
I have created a Schema called AvailableDomains (simple strategy, 1 node).
In that keyspace I have created 1 table/ column family called domains with columns (id, urn, timestamp, flag). All of type text except timestamp is type timestamp.
I startup cassandra,
launch cqlsh -3,
use AvailableDomains,
and then issue the following command to pull in a csv:
COPY domains (id, urn, timestamp, flag) from 'test.csv' where HEADER= TRUE;
I get an error saying: Improper COPY command
Question: What am I doing wrong?
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
Location of csv is in cassandra/bin (same dir where cqlsh is located).
OS: Centos 6.4 64bit
This fixed me up for CQL 3:
COPY domains FROM 'test.csv' WITH HEADER = true ;
The reason I am using Header = True is the first line of my CSV has the column names. Hope this helps someone else out there.
这篇关于Cassandra CQL3导入CSV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!