I am trying to create a cloning script that will copy a users data from production or staging to development environment, without dumping to a file and importing that file.
I am using Node and Javascript.
I started out trying just to use regular queries and taking the result and making new "create" queries to execute on my target database, but I couldn't get it to work and i later found out that it would probably take very long time to execute any way.
I then found "apoc.export.cypher.query" and { stream: true } and got a bunch of cypher statements in a string. Tried to execute this as a regular query but it seems like the :begin and :commit is not understood. I tried splitting the string into statements by guessing how it could work. It worked a little but got some issues. More searching and I found “apoc.cypher.runMany”, yey. It seemed to work!
But to my sad surprise, most of the data wasn't copied, not even close. I then dumped the statements to disk to have a look at them and noticed that most of the stuff was missing. There was no statements for creating any relationships. What is going on? Why is the export not returning all the results that the regular query did? Is there built in limit when using apoc.export.cypher.query ?
I then tried “apoc.export.graphml” but bumped in to the problem with labels not being copied and when I fixed that I started getting collisions on id’s (not sure if its possible to export/import graphml without also copying the node ids??
I am running out of ideas. 😰
Any help is appreciated. How should I approach the problem?