I am trying to insert a record in a vertex in OrientDB using python client. the code is as follows
print(recommendationCluster['recommendation'])
for recommendation in recommendationCluster['recommendation']:
item = menuitems.loadMenuItemWithId(str(recommendation),orientclient)
items.append(item._rid)
print("Creating cluster of ", items)
cluster['recommendeditems'] = items
dbData = {}
dbData['@RecommendationCluster']=cluster
print("Storing recommendation cluster ", dbData)
newCluster = orientclient.record_create(-1, dbData)
In the console i see the message
Storing recommendation cluster {'@RecommendationCluster': {'recommendeditems': ['#126:2', '#124:8']}}
Which suggests it has got the links to the right items and is performing the insert.
But the record_create fails and i get the following exception in the OrientDB server console
com.orientechnologies.orient.core.exception.ODatabaseException: Impossible to serialize invalid link #-1:-1
Would appreciate if someone can point out what i am doing wrong here.
Fixed the issue. As the recommenditem is a LinkSet, the values to be passed to the array should be reference to the Link object
has to change to
That change fixed the issue and the records are getting inserted successfully