https://docs.datastax.com/en/cql/3.1/cql/cql_reference/copy_r.html

感谢领导,感谢同事,与其自己百思不得其解,不如一个问题就搞定了。

Step1: 下面是导出的脚本,表,表字段

copy testbyjasmine(uid,address) to 'C:\testbyjasmine.csv' with ENCODING='UTF-8' and DELIMITER ='|';

CASSANDRA How to import and export data-LMLPHP

Step2: 下面是导入的脚本,只是将to换成了from

copy testbyjasmine(uid,address) from 'C:\testfile.txt' with DELIMITER ='|';

CASSANDRA How to import and export data-LMLPHP

Step3: 具体参数翻译

COPY table_name ( column, ...)
FROM 'file_name' | STDIN
WITH option = 'value' AND ...

COPY table_name ( column , ... )
TO 'file_name' | STDOUT
WITH option = 'value' AND ...

CASSANDRA How to import and export data-LMLPHP

Legend
Uppercase means literal    大写表示语法
Lowercase means not literal   小写表示你的表名变量
Italics mean optional    斜体表示可选
The pipe (|) symbol means OR or AND/OR  管道表示或 或者  并且的关系
Ellipsis (...) means repeatable    省略号表示可接受的??
A semicolon that terminates CQL statements is not included in the synopsis.    分号表示cql语句的结尾,有了分号,表示此cql语句结束,否则在等

Step 4: 具体

CASSANDRA How to import and export data-LMLPHP

05-11 11:04