Cypher procedures & Functions....in python and Javascript


(M. David Allen) #1

This is very experimental, but I thought I'd post it here to see if anyone else is interested. It turns out there's an experimental JVM called GraalVM (https://www.graalvm.org/). It's got a lot of different optimizations, but it's also interesting because it supports execution of javascript and python inside of the JVM.

I took this idea and built a proof of concept called Magnolia (https://github.com/moxious/magnolia) that allows you define stored procedures and functions that are implemented in python and javascript. The plugin can "watch" those files on the filesystem, and hot reload them, so that if you change the source the implementation updates. In other words, you can redeploy procedures & functions without restarting neo4j, or using java.

JavaScript works better, because python support in GraalVM is very early. The biggest holdup in this approach is that it does require you run Neo4j on top of a non-standard JVM. The repo provides a docker container that does this for you though.

I'm planning on making some more progress with this and doing more testing, and then possibly writing up a bigger tech article on the topic. For now, it's just a side hobby, but it's working.