0

データベースにデータを入力していますが、次のモデルがあります。

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

しかし、なんらかの理由で、データベースに入力しようとしたときに、同じ名前でアーティストとスラッグが異なる 2 つのアルバムがある場合、次のエラーが発生します。

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

name パラメータが一意にならないようにするにはどうすればよいですか?

4

0 に答える 0