6

我想将 CSV 文件导入 cassandra。当我在 cassandra cqlsh 上编写此命令时,出现错误:命令为:

COPY table ( ID,  name) FROM 'table.csv' WITH HEADER = TRUE;

和错误:

Can't open 'table.csv' for reading: [Errno 2] No such file or directory: 'table.csv'

谁能告诉我这是什么意思?

4

3 回答 3

2

table.csv 文件应该在 cassandra 安装目录(运行 cqlsh 的位置)中。

文件名区分大小写,因此请检查原始文件名大小写。

于 2015-06-16T07:02:17.760 回答
0

In cassandra, It is required to mention the file name correctly (case sensitive).

use pwd command to know the current path in ubuntu and then give the file name.

For example if my path after executing pwd command is /home/xyz/Docs

Then cassandra command to copy the file is

COPY table ( ID,  name) FROM '/home/xyz/Docs/table.csv' WITH HEADER = TRUE;
于 2019-08-28T10:23:06.670 回答
0

确保您的本地目录应该是相同的,并且也有相同的文件。

cqlsh.bat 192.168.1.xx -k [keyspace name] -e "COPY [domain] FROM 'filename' WITH HEADER=true"
于 2016-01-25T10:08:48.870 回答