Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-18-2023 07:25 PM
Hi, I'm tring to import info from MySQL database to Neo4j using ETL Tool, and I already know that relation is built based on the foreign key according to https://neo4j.com/developer/neo4j-etl/.
But now my problem is that I don't know how to creat relation between nodes with same label, like this [: REPORTS_TO] relation in Employee node example:
01-18-2023 08:45 PM
If you want to create a relationships between employee with id = 0 (subordinate) and employee with id = 2 (superior), then the following query will do so:
match(n:Employee{id:0})
match(m:Employee{id:1})
merge(n)-[:REPORTS_TO]->(m)
If you want employee with id = 0 to report to himself, then the following will do so:
match(n:Employee{id:0})
merge(n)-[:REPORTS_TO]->(n)
Is this what you are looking for?
01-18-2023 09:06 PM
Thanks for the reply. But I want this relation appear automaticly during the mapping stage when using ETL Tool, more specifically, I want to figure out if it's possible(if it is, then how) to config my foreign key of table from MySQL database, so that I dont have to set this relation myself back in Neo4j, like this below⬇
01-19-2023 02:58 PM
Under 'Actions' column add a flag named 'Self' and use that flag in your code for self merging.
All the sessions of the conference are now available online