I am loading a csv file with cypher
query. The csv file is having 4 columns. 2 for columns and 2 for tables as shown below.
I want to create 2 types of nodes database and tables from those 4 columns. How can I create unique nodes for database and columns and to have relationships between them?
As per logisima's
answer I added below query to create nodes for database and columns and added relationships. But there is some duplication in nodes.
`LOAD CSV WITH HEADERS FROM 'file:///test1.csv' AS row
MERGE (source:Database { source: row.Source_DB})
MERGE (target:Database { target: row.Target_DB})
MERGE (source_table:Table { source_table: row.Source_Table})
MERGE (target_table:Table { source_table: row.Target_Table})
MERGE (source)-[:LINKED_TO]-> (target)
MERGE (source)-[:LINKED_TO]-> (source_table)
MERGE (source)-[:LINKED_TO]-> (target_table)
MERGE (target)-[:LINKED_TO]-> (target_table)`
Please bear with me I'm new to Neo4j.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…