Neo4j 如何在 Cypher 语句中处理像“"这样的特殊字符 [英] Neo4j how to handle special characters like ” in Cypher statements

查看:111
本文介绍了Neo4j 如何在 Cypher 语句中处理像“"这样的特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 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 ‘ give error'})

如果我改为:

MERGE (p:Node {name:"这个符号‘给出错误"})

它可以用于语句结束,但是当 在输入字符串中时它会失败.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆