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

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.

2 Likes

Hello David,
is there an update on this project? (Especially concerning the python support)

As i am a python developer i am interested in writing user defined procedures without having to use java for this.

Best wishes

Sorry -- no update available here. The basic techniques that this repository uses will work, but the code may be a bit out of date at this point. GraalVM support for python has come along way, but Neo4j hasn't yet productized this kind of approach yet, and as far as I know in enterprise contexts, GraalVM isn't yet a supported JVM to use with Neo4j. This is still at the stage of an experiment.

1 Like