cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Copy node from 1 db to another db and creatin new dbs when a node is created

Hi all,

I want to know if there is a way to copy nodes/relationships from a db to another db in the same dbms? Also would it be possible to create a db when a particular node/relationship is created in the same dbms?
Thanks in advance

1 ACCEPTED SOLUTION

On the first question, in 4.1 you can use fabric queries to query multiple graphs. Doing this, you could match a node in one graph, and then CREATE the same node in a second graph.

https://neo4j.com/docs/operations-manual/current/fabric/queries/#fabric-query-multiple-graphs

On the second question - please have a look at APOC triggers:

http://neo4j-contrib.github.io/neo4j-apoc-procedures/3.5/operational/triggers/

Basically what you would want to do is create an APOC trigger that only fires when the nodes you are interested in are created. When that happens, you can use other APOC / cypher calls to do things like run the CREATE DATABASE statement on the systemdb

View solution in original post

3 REPLIES 3

On the first question, in 4.1 you can use fabric queries to query multiple graphs. Doing this, you could match a node in one graph, and then CREATE the same node in a second graph.

https://neo4j.com/docs/operations-manual/current/fabric/queries/#fabric-query-multiple-graphs

On the second question - please have a look at APOC triggers:

http://neo4j-contrib.github.io/neo4j-apoc-procedures/3.5/operational/triggers/

Basically what you would want to do is create an APOC trigger that only fires when the nodes you are interested in are created. When that happens, you can use other APOC / cypher calls to do things like run the CREATE DATABASE statement on the systemdb

Hi @david.allen
Thanks for the response.
For the first question, is there a way to do this without using fabric as this is only available in enterprise edition?

you could do it by writing a program using the official drivers. You could then create connections to two separate databases, query from one, and then use that to inform a write query to the other.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online