Unable to load CSV with COPY command in cqlsh, getting "Struct() argument 1 must be string, not unicode"

121 Views Asked by At

I want to import a csv file to table in cassandra in docker container. I have added the csv file to container using below command
docker cp file_location docker_file_location.

I have copied the CSV file to docker container using the docker cp command. Now I are trying to import CSV using COPY. Here is the command which I am using

EDIT : I have tried using STDIN from which I will take the Input from the terminal, still it gives same error.

I am getting the below error and I am not able to understand it.

Failed to import 1000 rows: ParseError - Struct() argument 1 must be string, not unicode,  given up without retries

I tried the below command

COPY keyspace.table_name (id,id_type,location_id,event_source,event_name,message_json,source_ts,timestamp)
  FROM '/myFile0.csv' WITH DELIMITER=',' AND  HEADER=TRUE;
1

There are 1 best solutions below

2
Razvan I. On

You can check the data types of the columns in the table schema and compare them to the data types of the columns in the CSV file. Make sure that they match and that the data in the CSV file is in the correct format for the corresponding column.