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.

Is there a way to make Neo4j work like SQL's Triggers?

I found trigger procedures and functions of APOC but I am confused about it's usage.

5 REPLIES 5

Hi,

Maybe @david.allen's blog post would be useful for seeing how you can use APOC triggers?

The article that Mark linked does have a concrete example about how to use APOC triggers. I'd be curious to know if that helps at all.

Happy to answer other questions though. Maybe the place to start is, what do you want to do? What does your data model look like?

Thank you. I will ask you if I have any queries.

Hey,

I wanted to created log on the updates and deletions of nodes in Graph format itself. Can you tell me how to do. that?

Inside of Neo4j there is an object called a TransactionEventHandler which can do this. APOC uses it to implement the triggers themselves. So to get a log of updates/deletes, the simplest way is to use APOC triggers to do whatever else you like on the basis of what changed.

Your other option is to use neo4j-streams to do the same thing, with Neo4j producing records to something like kafka. Every time something changes in the DB, it fires off a new message to kafka, which you can process separately there.

https://neo4j-contrib.github.io/neo4j-streams/

Check the producer section of the docs and the transaction event handler.