Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-27-2021 08:21 AM
my python code to create a node is
results=_session.run( 'CALL apoc.cypher.run("merge (s:SHOT:$videoshot) return s", {'videoshot': 'Matrix'}' )
Want to create a Node with multiple labels, one of the labels is computed. running the above code gives the following error:
create shot exception {code: Neo.ClientError.Statement.SyntaxError} {message: Invalid input '{': expected "+" or "-" (line 1, column 60 (offset: 59))
"CALL apoc.cypher.run("merge (s:SHOT:$videoshot) return s", {'videoshot': 'Matrix'}) - call apoc with params substitution is not working" ^
I am using apoc.cypher.run() since I found out that regular cypher does not support dynamic node labels. software version I am using are:
python driver version neo4j==4.3.5
python 3.8
OS - ubuntu 20.04
help would be much appreciated.
09-27-2021 09:24 AM
Labels cannot be used as regular Cypher parameters, unless you use functions such as APOC setLabels: apoc.create.setLabels - APOC Documentation.
You can also work around this with basic string concatenation, but make sure your labels are sanitized or else the code will be vulnerable to Cypher injections.
All the sessions of the conference are now available online