I'm using python+py2neo with neo4j I am assigning my SQL db's auto-assigned record ID as a foreign key in my neo4j database.
I'm using get_or_create_indexed_node() to create a new node with a unique id if a node with this ID does not already exist in the neo database.
neo4jdb.get_or_create_indexed_node(index='Company', key='cid', value=self.id, properties={'cid' : self.id})
...using py2neo's wrapping of the neo REST interface. Is this safe? I think a couple times it may still have duplicated, creating new nodes with the same ID. Is there a better way to do this, ensuring uniqueness of an id foreign key across nodes of the same index?
It should be perfectly safe as the method is a simple wrapper around the API call; it does not carry out any of the uniqueness management on the client side. Are you able to show some code which produces these duplicates?
Cheers, Nige