neo4j / apoc

Apache License 2.0
96 stars 28 forks source link

[SGrPWNEf] Fixes backslashes parsing in csv import / export #572

Closed ncordon closed 9 months ago

ncordon commented 9 months ago

Cherry-picks https://github.com/neo4j-contrib/neo4j-apoc-procedures/pull/3898

What

Uses RFC4180Parser instead of CSVParser as suggested here

Why

Because the case where we have a quote " in a value we want to export / import from csv was not working:

CREATE (n:Test {name: 'Test', value: '{"new":"4\'10\\\""}'});
CALL apoc.export.csv.all("test.csv", {bulkImport:'true'});
MATCH (n) DETACH DELETE n;
CALL apoc.import.csv([{fileName: 'file:test.nodes.Test.csv', labels: ['Test']}],[],{});
MATCH (n: Test) RETURN n.value

should give us a roundtrip where the result is "{"new":"4'10\""}"