Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site maintenance this Wednesday, February 1. Disruptions expected as we migrate the forums.

How to merge two databases?

Graph Buddy


I was working on two databases which have the same nodes , each one was dedicated to a precise year. here is an example fo my database 2017 :

For 2018 , nodes will have 18 instead of 17 in the name of each node (as you can see in the screenshot).
To recognize them before combining both , I am adding a new property for each node in each year which will be (year : '2017') this is an example for nodes of 2017.

What I am looking for is how to combine both of them in just one database knowing that I have a backup of each year (I copied the folder "data of each one) , and we can find some data which are the same but they dont have the same property "year" .

So my question is : how can I combine both of them and get each two nodes in just one ? for example : I want to have Contrat1718 instead of a node for each year.


Node Clone


consider to use APOC. Here is how to use.

[on export side]

  1. enable APOC(Neo4j Desktop is easy to enable)
  2. set "apoc.export.file.enabled=true" into your database config
  3. (re)start database
  4. open Neo4j browser
  5. call "CALL apoc.export.cypherAll('/usr/tmp/test1.cypher', {format:'plain'})"

merge exported files like this

cat test1.cypher test2.cypher > target.cypher

[on import side]

  1. enable APOC
  2. set "apoc.import.file.enabled=true" into your database config
  3. start database
  4. open terminal
  5. run command
cat /usr/tmp/target.cypher | bin/cypher-shell -u yourusername -p yourpassword

This procedure doesn't care about duplicated nodes and relationships. I hope this may helps.

Thank you man 🙂 I already solved this problem by using APOC as well , but I used another method ; I exported all nodes and relations adn then I merged them by using excel and then I imported them and it worked as well but your idea is much better especially in term of time !
Thnak you again 🙂

I tried to "cat" the .cypher files but it's not working and it is giving me this error
Invalid input ' ': expected 'a/A' (line 1, column 4 (offset: 3))
"cat e.cypher r.cypher > target.cypher"

it is pointing on the space between cat and the "e".
Do you have any idea to solve this problem ?

Thank you in advance