cpimport error when csv file some filed inlcude \n

2 posts / 0 new
Last post
baoxiao
baoxiao's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: Jun 13 2013
Junior Boarder

Posts: 1

james Chen
cpimport error when csv file some filed inlcude \n

<p>When I try to import data from CSV file to infinidb using cpimport, if some filed include &#39;\n&#39;&nbsp; it will report error: Data contains wrong number of columns; num fields expected-37; num fields found-15. it seems it didn&#39;t read the whole record.</p>

allan.wax
allan.wax's picture
Offline
Last seen: 1 month 1 week ago
Joined: Jun 14 2014
Junior Boarder

Posts: 12

Allan Wax
For our purposes we pre

For our purposes we pre-condition the data before using cpimport to load it.  This include 'NULL' string, escape tabs and making sure the column count is correct.  Between sed and awk this quickly produces clean data to import.

 

In your case you may need to replace the literal string \n  (a backslash followed by the letter 'n') with a space so it doesn't break the import.