Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 新模型类定义_Python_Neo4j_Neomodel - Fatal编程技术网

Python 新模型类定义

Python 新模型类定义,python,neo4j,neomodel,Python,Neo4j,Neomodel,我在弄清楚如何设置Neomodel以使其工作时遇到了实际问题。我已经在models.py中定义了我的类,我正在导入它们,但我得到的只是一个 ClassAlreadyDefined:类模型。已存在带有标签的相册 已定义:{frozenset({'Album'}):} 错误。下面是我的代码的样子,例如: from neomodel import StructuredNode, StringProperty, DateTimeProperty, IntegerProperty, UniqueIdPro

我在弄清楚如何设置Neomodel以使其工作时遇到了实际问题。我已经在models.py中定义了我的类,我正在导入它们,但我得到的只是一个

ClassAlreadyDefined:类模型。已存在带有标签的相册 已定义:{frozenset({'Album'}):}

错误。下面是我的代码的样子,例如:

from neomodel import StructuredNode, StringProperty, DateTimeProperty, IntegerProperty, UniqueIdProperty, RelationshipTo, RelationshipFrom

    
class Album(StructuredNode):
    uid = UniqueIdProperty()
    band = StringProperty()
    name = StringProperty()
    url = StringProperty()
    band_name = StringProperty()
    year = IntegerProperty()
    
    genres = RelationshipTo('Genre', 'TAGGED')
    fans = RelationshipFrom('Fan', 'BOUGHTBY')

重新启动python内核修复了这个问题。问题是,第一次运行时,类定义进入neomodel注册表,随后的运行会认为您正在重新定义类

可能有一个更简单的修正,一些标志表明我们正在进行开发和测试,但不确定这是什么