更新neo4j节点信息
2024-10-19 11:56:04
将多个属性的内容更新到节点上
def update_by_id(id,graph,**kwargs):
"""
更新节点的属性
根据节点的ID来更新节点的属性,如果存在该属性,则更新,如果不存在该属性,则添加
"""
if graph is None:
graph = get_graph()
if kwargs is None:
return None
match = "match (x) where id(x)=%s " % (id)
fields_str=''
for k,v in kwargs:
if v is not None:
temp = " set x.%s = '%s' " % (k,v)
fields_str += temp match = match + fields_str
match = match + " return id(x) as x_id"
result = graph.run(match).data()
if result is not None and len(result > 0):
id = result[0]["x_id"]
return id
return None
最新文章
- 通过innobackupex实现对MySQL的完整备份与还原
- listview侧滑菜单swipemenulistview的简单使用
- 调用MyFocus库,简单实现二十几种轮播效果
- iOS崩溃调试的使用和技巧总结
- Centos7安装配置NFS服务和挂载
- WebService 基础使用&;cxf第三方Service使用
- 创建缓存文件(。php)
- Java-在线聊天系统-线程
- mars android视频学习笔记一:Activity生命周期
- POJ 3468 A Simple Problem with Integers(线段树区间更新,模板题,求区间和)
- django1.6之mysql配置
- mysql数据库引擎问题汇总
- Redis的AOF功能
- Java -- sleep and wait
- Vue跨门槛系列之实例的阐述
- python简单爬虫技术
- 关于Net core 的https 设置小知识
- linux中的&;&;,|| 与 () 命令
- 驱动调试(三)oops确定函数PC
- 主机连接虚拟机redis 服务器