Neo4j如何处理Cypher语句中的特殊字符,如"\" [英] Neo4j how to handle special characters like ” \ in Cypher statements
问题描述
我正在使用py2neo将JSON数据作为chyper语句加载到Neo4j中.
我的问题是,有时我想作为属性导入到节点的字符串中有 ‘ \
等符号:
I am using py2neo to load JSON data into Neo4j as chyper statements.
My problem is that sometimes there are signs as " ‘ \
etc in the strings I want to import as properties to Nodes:
MERGE (p:Node {name:’This sign ‘ gives error’})
如果我更改为:
MERGE (p:Node {name: This sign ‘ gives error})
它将对语句结束有效,但是当在输入字符串中时将失败.
It will work for the statement over but it will fail when a "
is in an input string.
有没有办法说字符串中允许所有(或几乎所有)特殊字符? 抱歉,这是一个愚蠢的问题:)
Is there a way to say that all (or almost all) special character is allowed inside the string? Sorry if this is a stupid question :)
推荐答案
我建议使用参数,然后密码解析器看不到它们.
I would suggest to use parameters, then the cypher parser doesn't see them.
这只是一个名称->您通过字典传递给execute方法的字符串.
And it's just an name -> string you pass via a dictionary to the execute method.
这篇关于Neo4j如何处理Cypher语句中的特殊字符,如"\"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!