Reputation: 42
I'm trying to execute a simple parameterized cypher query which actually fails due to a syntax error.
params = {
"k" : k,
"v" : v,
"p": {
"name": "marc"
}
}
query = "CYPHER 2.0 MATCH (n { { k } : { v } }) SET { p } RETURN n"
data, metadata = cypher.execute(graph_db, query, params=params)
...
SyntaxException: Invalid input '{': expected whitespace, comment, an identifier, '}' or UnsignedInteger (line 1, column 12)
"MATCH (n { { k } : { v } }) SET { p } RETURN n"
I'm using py2neo 1.6.3 with flask.
Thanks in advance!
/Marc
Upvotes: 0
Views: 1035
Reputation: 5001
Parameters are only allowed in certain places. Try the following statement:
MATCH (n { k : { valueParam } }) SET { n.name = { nameParam } } RETURN n
Your map would contain:
params = {
"valueParam " : "v",
"nameParam " : "marc"
}
To state the Cypher docs:
Parameters can not be used as for property names, relationship types and labels, since these patterns are part of the query structure that is compiled into a query plan.
Upvotes: 1