Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-23-2020 09:57 AM
Hello
is there any way to transfer the content from one graphics database to another graphics database so that the two contents are together only in one database?
Solved! Go to Solution.
04-28-2020 01:08 AM
Ah yes, importing it again is rather useful too
The way I do it is again via APOC with a call like this:
CALL apoc.cypher.runFile('filename) yield row, result"
Where filename is the name of your exported file. The Neo4J server assumes it being in the import folder if I remember correctly.
I choose the APOC route because it is some functionality I need to use in the user-interface of the application I am working on.
Note though, the file created on export is just a Cypher file so if this is a one-off thing you might use the cypher-shell instead, see cypher-shell --help for details but the gist is:
cat some-cypher.txt | cypher-shell
Hope this helps,
Paul
04-23-2020 02:02 PM
By "together in one database", do you mean one neo4j system with two graphs in it? Or do you mean 1 neo4j system with 1 graph, which is the "merged" version of both of the two inputs?
04-23-2020 04:03 PM
I have 1 Neo4j system with 2 bank, each has 1 graph and I want to put these graphs in 1 database of the same Neo4j system.
04-23-2020 04:22 PM
With APOC you could create an export in Cypher format of one Graph and use the resulting Cypher code to import it in the other Graph. That way you essentially would merge both graphs into one.
04-23-2020 05:16 PM
how do I create this export in cypher?
04-24-2020 02:27 AM
See https://neo4j.com/docs/labs/apoc/current/export/cypher/ for the gory details.
In short:
apoc.export.file.enabled=true
apoc.import.file.enabled=true
CALL apoc.export.cypher.query(
"MATCH p=(a:MyActivity {{uuid:'{activity_uuid}'}})-[:BLOCK]-()
RETURN p","filename",{format:'plain',cypherFormat:'create'}
)
The code above is from a live project I am working on. Replace the MATCH with the one which works for your model. The "filename" is the file to export to, this will be created in your "import" folder in your Neo4J install.
Typical this is something like /var/lib/neo4j/import but you can ask the server for its location by:
CALL dbms.listConfig() yield name,value where name='dbms.directories.import' return value
Hope this helps!
Paul
04-27-2020 08:09 PM
Hi Paulo
one more doubt. I managed to create the export file and now how do I import and extract the graph in the other database?
I created the file export.cypher
thank you very much for your help
04-28-2020 01:08 AM
Ah yes, importing it again is rather useful too
The way I do it is again via APOC with a call like this:
CALL apoc.cypher.runFile('filename) yield row, result"
Where filename is the name of your exported file. The Neo4J server assumes it being in the import folder if I remember correctly.
I choose the APOC route because it is some functionality I need to use in the user-interface of the application I am working on.
Note though, the file created on export is just a Cypher file so if this is a one-off thing you might use the cypher-shell instead, see cypher-shell --help for details but the gist is:
cat some-cypher.txt | cypher-shell
Hope this helps,
Paul
04-28-2020 04:52 PM
thank you very much, Paulo
worked correctly. Hugs!!
05-13-2021 06:09 AM
I've added the apoc.import.file.enabled=true
in the neo4j.conf file
I've exported the entire graph with
CALL apoc.export.csv.all("filename.csv", {})
I've run the runfile-cypher
CALL apoc.cypher.runFile('filename.csv') yield row, result
I still get this error
What can be done as to export a graph and import it again
05-14-2021 05:41 AM
Did you restart the server after the configuration change?
06-30-2021 12:30 AM
That did the trick
All the sessions of the conference are now available online