Neo4j LOAD CSV not working when multiline fields are encountered

neo4j-sh (?)$ USING PERIODIC COMMIT
> LOAD CSV WITH HEADERS FROM "file:/home/ubuntu/data/woka-data/woka-data.csv" AS row
> MERGE (woka:Woka           {woka_id:        row.woka_id, woka_title: row.woka_title});
IllegalMultilineFieldException: At file:/home/ubuntu/data/woka-data/woka-data.csv:834 - Multi-line fields are illegal in this context and so this might suggest that there a field with a start quote, but a missing end quote.

      

My kernel version is 2.2.3 and the file is quite large:

-rwxr-xr-x 1 ubuntu ubuntu 2508218727 Jul 21 17:54 woka-data.csv

      

Any hint how to fix this?

I changed the order of the fields in the file and now the first line of the message is sent on line 83. This is the line:

97801322605720000000,eng,Addison Wesley Longman,,"Wri& Speakg at Work& Build Own CC& Mst
: Perils"

      

This is a new line before

: Dangers

How to fix it?

This error seems to be related to this kernel version. Before upgrading, I used a similar file to import the same data having multi-line fields and it worked.

What can I do now?

+3


source to share


2 answers


The bug remains in the 2.2.3 kernel, despite the fixes that have been fixed. I had to clear all data during extraction. I removed all characters causing LOAD CSV error with error message or similar.



+3


source


Found this gem in the source code. See if any lines (lines) in your csv have illegal quoting. Choose them and try again.

public class IllegalMultilineFieldException extends FormatException
{
    public IllegalMultilineFieldException( SourceTraceability source )
    {
        super( source, "Multi-line fields are illegal in this context and so this might suggest that " + "there a field with a start quote, but a missing end quote." );
    }
}

      

This was a problem before Neo4j 2.2.2. The bug report can be found here .



If you are using any version prior to 2.2.2 update and it should work

I am using the Neo4j kernel version - Diagram Database Kernel (neo4j-kernel), version: 2.2.3

+1


source







All Articles