Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-30-2018 01:22 PM
Hi,
I am trying to read my CSV file which has spaces in column name: Column A = 'Source Variable'
When I am trying to read this, it gives me an error:
Neo.ClientError.Statement.SyntaxError: Invalid input 'V': expected whitespace, comment, '(', '.', node labels, '[', "=~", IN, STARTS, ENDS, CONTAINS, IS, '^', '*', '/', '%', '+', '-', '=', "<>", "!=", '<', '>', "<=", ">=", AND, XOR, OR, LOAD CSV, FROM, INTO, START, MATCH, UNWIND, MERGE, CREATE GRAPH >>, CREATE >> GRAPH, CREATE GRAPH, CREATE, SET, DELETE GRAPHS, DELETE, REMOVE, FOREACH, WITH, CALL, PERSIST, RELOCATE, RETURN, SNAPSHOT, UNION, ';' or end of input (line 4, column 23 (offset: 99)) "WHERE NOT line.Source Variable IS NULL and NOT line.SourceFile is NULL" ^
My code:
LOAD CSV WITH HEADERS FROM "file:///Matrix.csv" AS line WITH line
WITH line
WHERE NOT line.Source Variable IS NULL and NOT line.SourceFile is NULL
MERGE (a: Studytest {name: line.Studytest, type: 'Study'})
//CREATE (domain: Domain {name: line.Domain})
mergE (b: Domaintest {name: line.Domaintest, type: 'Domain', domain_identifier: line.Studytest + line.Domaintest})
Merge (c: SourceFile {name: line.SourceFile,type: 'Source_File', file_identifier: line.Studytest + line.Domaintest + line.SourceFile})
Merge (d: SourceVariable {name: line.Source Variable,type: 'Source_Variable', field_identifier: line.Studytest + line.Domaintest + line.SourceFile + line.Source Variable})
MERGE (d)-[z:Part_of]->(c)
MERGE (c)-[q:Part_of]->(b)
MERGE (b)-[p:Part_of]->(a)
RETURN a;
Solved! Go to Solution.
11-30-2018 01:46 PM
11-30-2018 01:46 PM
you need to use back ticks for quoting, so
line.`Source Variable`
11-30-2018 02:21 PM
Hi,
I tried that. I got the below error:
Neo.ClientError.Statement.SyntaxError: Invalid input ''': expected an identifier, whitespace, a function name or a property key name (line 4, column 16 (offset: 92))
"WHERE NOT line.'Source Variable' IS NULL and NOT line.SourceFile is NULL"
11-30-2018 02:22 PM
Your example is using single quote characters: '
. This is not the same as backticks (on a US keyboard, shares the same key as the tilde ~ symbol, and is next to the 1
key): `
11-30-2018 02:24 PM
Thank you!
Its resolved now
All the sessions of the conference are now available online