1

I'm loading a tab delimited file using LOAD CSV where the fieldnames are on the first line of the file. However a few of the field names have a '.' in and I can't get any of the ways mentioned in similar posts to work. (Can't query properties with colon) for example.

LOAD CSV WITH HEADERS FROM "file:/home/user/Desktop/file" AS line FIELDTERMINATOR '\t'
MERGE (n:IP {addr: `line.id.orig_h` });

and my file has this in it:

> ts    uid id.orig_h   id.orig_p   id.resp_h   id.resp_p
1442775590.662028   CAYN7w2ejAV3Rji8X2  1.2.3.4 55819   8.8.8.8 53
1442775595.716739   C0AaEWYns8YwqC9Sg   1.2.3.4 55826   8.8.8.8 8192
1442775335.453432   C0AaEWYns8YwqC9Sg   1.2.3.4 55555   8.8.8.8 8192

The error is: QueryExecutionKernelException: Cannot merge node using null property value for addr

If I use CREATE instead of MERGE it will create a node but the addr property is empty.

If I enclose the field name in backticks like a few posts mention to do, I get the following error:

QueryExecutionKernelException: line.id.orig_h not defined (line 2, column 20 (offset: 107)) "MERGE (n:IP {addr: line.id.orig_h })"

I'm using neo4j community v2.2.5.

If I get rid of the '.' in the field names the graph is created successfully.

Many thanks in advance

Community
  • 1
  • 1

1 Answers1

1

Chris is right, backticks are your friend:

 {addr: line.`id.orig_h` }
Michael Hunger
  • 41,339
  • 3
  • 57
  • 80