0

I am trying to unpack a list of dictionaries and use these as args for a function that creates nodes on a neo4j database based on these dictionaries. The error that occurs is ,that instead of using each dict for a new node, the function tries to insert the first dict of the list where the number of insert attempts is equal to the number of list elements.

I am trying to use the create_or_update function in neomodel

https://neomodel.readthedocs.io/en/latest/batch.html

comment_list = Commentary.create_or_update(*unique_interactions)

unique_interactions is my list of dictionaries and the output comment_list should contain all generated nodes but instead contains the first node as many times as unique_interactions has elements while on the database only one Commentary node was generated. Originally I had just passed the list without unpacking it which didnt work at all but now I cant figure out what is wrong this time.

Blob
  • 1

1 Answers1

0

If I understand the problem correctly, then you need to use a copy of the dictionary to pass from function:

d = {'a': 'a'}
b = d.copy ()
iqmaker
  • 2,162
  • 25
  • 24