If you need to expand the Cypher language, Memgraph provides public APIs for writing custom query modules in Python and C.
Python API is defined in the
mgp module that can be found in the Memgraph
/usr/lib/memgraph/python_support. In essence, it is a
wrapper around the C API. If you wish to write your own query modules using the
Python API, you need to have Python version
3.5.0 or above installed.
You can develop query modules in Python from Memgraph Lab (v2.0 and newer). Just navigate to Query Modules and click on New Module to start.
Custom modules developed via Memgraph Lab are located at
C API modules need to be compiled to a shared library so that they can be loaded
when Memgraph starts. This means that you can write the procedures in any
programming language that can work with C and be compiled to the ELF shared
library format (
mg_procedure.h that can be found in Memgraph
/usr/include/memgraph contains declarations of all
functions that can be used to implement a query module procedure. To compile the
module, you will have to pass the appropriate flags to the compiler, for
clang -Wall -shared -fPIC -I /usr/include/memgraph example.c -o example.so