0

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;
  • Welcome to Stack Overflow! Your question is missing a few details. The general guidance is that you (a) provide a good summary of the problem that includes software/component versions, the full error message + full stack trace; (b) describe what you've tried to fix the problem, details of investigation you've done; and (c) minimal sample code that replicates the problem. Cheers! – Erick Ramirez Jan 16 '23 at 07:28
  • 1
    A friendly reminder to let you know that your question lacks information and you need to provide additional details. In particular, the table schema would be really relevant + the first few lines (1 or 2 is enough) of the CSV file. Cheers! – Erick Ramirez Jan 18 '23 at 02:52

1 Answers1

0

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.

Razvan I.
  • 239
  • 1
  • 5