diff --git a/pages/custom-query-modules.mdx b/pages/custom-query-modules.mdx index 36b607926..3eb01144c 100644 --- a/pages/custom-query-modules.mdx +++ b/pages/custom-query-modules.mdx @@ -23,7 +23,7 @@ and **Rust**. These procedures are grouped into modules - **query module** files (either `*.so` or `*.py` files). -# Developing your custom query module +## Developing your custom query module To develop your custom query module procedures you can follow the guides for each language: @@ -58,7 +58,7 @@ would be mapped in the Cypher query language as `example.procedure()` and Each query module file can contain multiple read and write procedures and functions. -# Modifying the existing query modules +## Modifying the existing query modules If existing MAGE library modules almost meet your needs, consider modifying them and make a contribution to the Memgraph Mage library. @@ -81,15 +81,12 @@ Then, select a language you want to develop in. {

Download the MAGE image

} - Run the following command to get the Memgraph and MAGE development Docker image: + Run the following commands to get the Memgraph and MAGE Docker image and download the toolchain used for building modules: ```shell - docker run -p 7687:7687 memgraph/memgraph-mage:-dev + docker run -p 7687:7687 memgraph/memgraph-mage: ``` - By running this command, you will get an image with the following tools - installed: `Python3`, `Rust`, `Clang`, `Make`, and `CMake`. - {

Develop a query

} When developing with Mage, take a look at the basis of developed [algorithms and utility procedures](https://github.com/memgraph/mage) and extend based on that. @@ -106,15 +103,26 @@ Then, select a language you want to develop in. Use the following command to start the MAGE container: ```shell - docker run --rm -p 7687:7687 --name mage memgraph-mage:version-dev + docker run --rm -p 7687:7687 --name mage memgraph-mage: ``` - Be sure to replace the version with the specific version, for example: + Be sure to replace the `` with the specific version, for example: ```shell - docker run --rm -p 7687:7687 --name mage memgraph-mage:1.4-dev + docker run --rm -p 7687:7687 --name mage memgraph-mage:3.1.1 ``` + {

Download and install toolchain and development dependencies

} + + Run the `make-dev-container.sh` script as `root` within the container to download the current toolchain version and install required `apt` packages: + + ```shell + docker exec -i -u root mage bash -c "./make-dev-container.sh" + ```` + + By running this command, your your container will have the following tools + installed: `Python3`, `Rust`, `Clang`, `Make`, and `CMake` alongside the toolchain used to build both Memgraph and MAGE. + {

Copy the files to the container

} Copy the files to the container named `mage`: @@ -125,10 +133,10 @@ Then, select a language you want to develop in. {

Enter the container

} - Position yourself inside the container as `root`: + Position yourself inside the container as `memgraph`: ```shell - docker exec -u root -it mage /bin/bash + docker exec -u memgraph -it mage /bin/bash ``` @@ -144,10 +152,16 @@ Then, select a language you want to develop in. {

Build MAGE

} - Build MAGE with the option to copy executables from `mage/dist` to `/usr/lib/memgraph/query_modules`: + Activate the toolchain and build MAGE: ```shell - python3 setup build -p /usr/lib/memgraph/query_modules/ + source /opt/toolchain-v6/activate + python3 setup build + ``` + + Then copy executables from `/mage/dist` to `/usr/lib/memgraph/query_modules` as `root`: + ```shell + docker exec -i -u root mage bash -c "cp -vr /mage/dist/* /usr/lib/memgraph/query_modules/" ``` {

Exit the container

} @@ -389,6 +403,11 @@ Then, select a language you want to develop in. + + + We currently do not produce MAGE images with cuGraph (since version 1.3). If this is something you require, please raise an [issue](https://github.com/memgraph/mage/issues) + + {

Download MAGE source code

}