neomodel的使用方法及坑

官方文档地址:https://neomodel.readthedocs.io/en/latest/getting_started.html

Stack Overflow:https://stackoverflow.com/questions/tagged/neomodel?tab=newest&pagesize=50

【坑一:id是内置属性】

class Person(StructuredNode):
#
如果有id类属性,最好写成uid等,不要直接使用id
uid = StringProperty(unique_index=True, required=True)
name
= StringProperty(required=True)

节点id是内置属性,写model时最好不要覆盖,否则后续创建节点时会出问题,会保存不了创建的节点。

【二:清空数据库写法】

from neomodel import db, clear_neo4j_database

clear_neo4j_database(db, True, True) # deletes all nodes and relationships

 

posted @ 2021-08-12 17:12  徐钏  阅读(703)  评论(0)    收藏  举报