I'm working on my first query module for Memgraph. I'm trying to find the best approach.
I have a query module that depends on a local submodule (firstone
):
import firstone
import mgp
import importlib
@mgp.read_proc
def procedure(context...):
importlib.reload(firstone)
firstone.call()
If I get it correctly, if firstone
module changes, the procedure is still using the previous code. How can I reload the Python query module during development?
You can use the use mg.load
to load or reload the given module. The correct syntax is CALL mg.load("py_example");
. After loading the module, all dependent Python's submodules that are imported will also be reloaded. The official documentation can be found on Memgraph site.