我有以下代码行
tx.run(CREATE n)
将neo4j的螺栓库用于python。
我将收到一个存储在变量中的用户输入,我希望据此命名节点。我应该如何处理这个?谢谢
另一个例子可能是这样。我收到一个 CQL 语法错误
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_)")
该tx.run("CREATE (playername_:Player)")
行引发以下错误
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"