I am trying to load .csv file into Cassandra with "|" as a delimiter but one of the record has got that & there is a record mismatch error. I have tried other delimiters but they are present in the records. When I use tab or special symbols as delimiters am getting this error:
"delimiter" must be an 1-character string"
Is there a way to load .tsv files directly into Cassandra?
Which version of Cassandra are you using?
There is a ticket (CASSANDRA-6773) for this issue in the Cassandra JIRA project. According to the ticket, it looks like the fix has been committed and applied as of version 2.0.7.
I just tried it and it worked for me (version 2.0.9):
[cqlsh 4.1.1 | Cassandra 2.0.9 | CQL spec 3.1.1 | Thrift protocol 19.39.0]
cqlsh> use stackoverflow;
cqlsh:stackoverflow> COPY trainsbydeparturetime(identifier, train_number,
origin_train_station, dest_train_station, departure_time, total_travel_time )
FROM '~/trainTimes.tsv' WITH DELIMITER='\t';
2 rows imported in 0.116 seconds.
Note the use of WITH DELIMITER='\t'
at the end.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With