I need to upload a CSV file that has functions which need to be executed in Neo4j to form relationship among nodes that are already present. I am using a Python script to upload the file. I am using the following code to achieve this -
result_relationships = db.run( "LOAD CSV WITH HEADERS FROM 'file:///New_Relationships.csv' AS Relation" " return *")
This is not creating any relationship in Neo4j.
My CSV file looks similar to the following picture -
I also tried reading the CSV line by line and executing the cypher query one by one. Following is the code -
with open('New_Relationships.csv', 'rt') as f:
reader = csv.reader(f)
for row in reader:
result = db.run(row)
This also did not help.
apoc.cypher.doIt()
, which will execute cypher snippets. – InverseFalcon