Reputation: 376
I am trying to load neo4j db using CSV file from python. I am able to connect and load the data without using UNWIND operation. But I want to use it for a faster load. I am getting the following error upon trying to use it.
{code: Neo.ClientError.Statement.SyntaxError} {message: Invalid input '': expected whitespace, '.', node labels, '[', '^', '*', '/', '%', '+', '-', "=~", IN, STARTS, ENDS, CONTAINS, IS, '=', '~', "<>", "!=", '<', '>', "<=", ">=", AND, XOR, OR or AS (line 1, column 16 (offset: 15)) " UNWIND {data1} as node" ^} I have the following code where I am using UNWIND. This is just a small sample I am trying to test out with.
cq1=""" UNWIND {data1} as node
MERGE (n:Person {id : node.ID})
SET
n.gender = node.GENDER"""
list_dicts_data1 = [{"ID": '1',"GENDER": 'Male'}]
graph.run(cq1, data1 = list_dicts_data1)
Any suggestions what is causing this error and how do I fix it?
Upvotes: 0
Views: 329
Reputation: 4495
I can't read the error clearly due to bad formatting, but which version of Neo4j are you running? The parameter syntax changed a while ago from {var}
to $var
. That might be the cause.
Also, have you considered using py2neo's bulk load API, which wraps this kind of statement for you? https://py2neo.org/2021.0/bulk/index.html
Upvotes: 1