I have the following line of code
tx.run(CREATE n)
using the bolt library for neo4j to python.
I will be receiving a user input which I store in a variable, and I wish to name the node according to that. How should I approach this? Thanks
Another instance could be this. I get a CQL syntax error with this
if(tx.run("MATCH(n:Player{name: playername_})" "RETURN n")):
tx.run("CREATE (playername_:Player)")
tx.run("MATCH(username_:User)(playername_:Player)" "CREATE (playername_)-[r:IN_TEAM]->(username_)")
else:
tx.run("MATCH(username_:User)(playername_:Player)" "CREATE (playername_)-[r:IN_TEAM]->(username_)")
The tx.run("CREATE (playername_:Player)")
line throws up the following error
neo4j.exceptions.CypherSyntaxError: {code: Neo.ClientError.Statement.SyntaxError} {message: Variable `playername_` not defined (line 1, column 22 (offset: 21)) "MATCH(n:Player{name: playername_})RETURN n"
I believe this could help you: