Neo4j和neomodel在单个参数上抛出唯一的异常

时间:2015-09-28 22:07:05

标签: python neo4j py2neo neomodel

我正在填充数据库,我有这个模型:

class Album(StructuredNode):
    name = StringProperty(unique_index=False, required=True)
    artist = StringProperty(unique_index=False, required=True)
    slug = StringProperty(unique_index=True, required=True)

但是出于某些原因,当我尝试填充我的数据库时,如果我有两张同名但不同艺术家和slug的专辑,我会收到此错误:

File "/Users/datascientist/Desktop/populate.py", line 66, in <module>
  album.save()   
File "/Users/datascientist/anaconda/lib/python2.7/site-packages/neomodel/signals.py", line 25, in hooked
  val = fn(self, *args, **kwargs)
File "/Users/datascientist/anaconda/lib/python2.7/site-packages/neomodel/core.py", line 159, in save
  self._id = self.create(self.__properties__)[0]._id
File "/Users/datascientist/anaconda/lib/python2.7/site-packages/neomodel/core.py", line 289, in create
  results = db.cypher_query(query, params)
File "/Users/datascientist/anaconda/lib/python2.7/site-packages/neomodel/util.py", line 216, in cypher_query
  raise UniqueProperty(e.message)

neomodel.exception.UniqueProperty

如何使其成为名称参数不唯一?

0 个答案:

没有答案