如何在cqlsh中将大量csv数据导入到cassandra中?

时间:2019-04-08 11:44:04

标签: cassandra nosql cassandra-2.0

尝试在cassandra中导入批量数据,但无法使用copy命令插入。大约有100000个文件。

尝试

copy dc FROM '/home/hukke/1.csv'  WITH MAXBATCHSIZE=10000;

copy dc FROM '/home/hukke/1.csv'  WITH HEADER=true;

但无法插入它们,这些错误不断弹出。

Failed to import 13 rows: InvalidRequest - Error from server: code=2200 [Invalid query] message="String didn't validate.",  will retry later, attempt 1 of 5
Failed to import 14 rows: InvalidRequest - Error from server: code=2200 [Invalid query] message="String didn't validate.",  will retry later, attempt 1 of 5
Failed to import 12 rows: InvalidRequest - Error from server: code=2200 [Invalid query] message="String didn't validate.",  will retry later, attempt 1 of 5
Failed to import 16 rows: InvalidRequest - Error from server: code=2200 [Invalid query] message="String didn't validate.",  will retry later, attempt 1 of 5

1 个答案:

答案 0 :(得分:0)

尝试了多次,并找到了许多用例后,发现这是可行的

COPY dc5 (table columns names ) FROM '/home/hukke/122.csv' WITH HEADER = true AND DELIMITER = ',';