Search code examples
csvimportcassandracql

Improper copy command in Cassandra cql shell


I know this is a quite starter and common question. But I am not successful. Please shed some light.

I have created a keyspace samplepqp with an table checkdel. I am trying to import data from a csv file which is located in same path as cql.

My csv file :

Unnamed|row_nr|PRD_ID|X_01|X_02|X_03
0|1|3170428144631014|25603.1|25445.1|19960.0

Used this command for copy.

COPY checkdel FROM 'C:\Users\skum\Documents\checkdelmiter.csv' WITH HEADER = true AND DELIMITER = '|';

But I am not getting data. What am i doing wrong?

Below is how I am working.

cqlsh:samplepqp> COPY checkdel FROM 'C:\Users\skum\Documents\checkdelmiter.csv' WITH HEADER = true AND DELIMITER = '|';
Using 7 child processes

Starting copy of samplepqp.checkdel with columns [unnamed, prd_id, row_nr, x_01, x_02, x_03].
Processed: 0 rows; Rate:       0 rows/s; Avg. rate:       0 rows/s
0 rows imported from 0 files in 0.723 seconds (0 skipped).
cqlsh:samplepqp> select * from checkdel;

 unnamed | prd_id | row_nr | x_01 | x_02 | x_03
---------+--------+--------+------+------+------

(0 rows)

Solution

  • Enclose file path with single quote

    Example :

    copy qsprawdata (row_nr,prd_id,x_01,x_02) FROM 'qspraw_sample.csv' with header=true;