Commit Graph

7 Commits

Author SHA1 Message Date
Ivan Paljak
b6b6403b06 Implement PyEdgesIterator and integrate with PyVertex
Reviewers: teon.banek

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2692
2020-02-27 15:57:02 +01:00
Teon Banek
ad892f2db3 Support typing annotations in Python Query Modules
Reviewers: mferencevic, ipaljak, tlastre

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2689
2020-02-27 13:18:57 +01:00
Ivan Paljak
32e56684db Add Python class for mgp_vertex
Reviewers: teon.banek

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2688
2020-02-26 14:01:43 +01:00
Teon Banek
e7f363ecbe Add Python class for mgp_edge
Reviewers: teon.banek, ipaljak, mferencevic

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2679
2020-02-25 10:26:08 +01:00
Teon Banek
34db077cbd Register Python procedures
Summary:
With this diff you should now be able to register `example.py` and read
procedures found there. The procedures will be listed through `CALL
mg.procedures() YIELD *` query, but invoking them will raise
`NotYetImplemented`.

If you wish to test this, you will need to run the Memgraph executable
with PYTHONPATH set to the `include` directory where `mgp.py` is found.
Additionally, you need to pass `--query-modules-directory` flag to
Memgraph, such that it points to where it will find the `example.py`.

For example, when running from the root directory of Memgraph repo, the
shell invocation below should do the trick (assuming `./build/memgraph`
is where is the executable). Make sure that `./query_modules/` does not
have `example.so` built, as that may interfere with loading
`example.py`.

    PYTHONPATH=$PWD/include ./build/memgraph --query-modules-directory=./query_modules/

Reviewers: mferencevic, ipaljak, llugovic

Reviewed By: mferencevic, ipaljak, llugovic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2678
2020-02-19 14:35:22 +01:00
Teon Banek
ad740e4ae2 Add _mgp.Graph and _mgp.VerticesIterator to embedded Python
Reviewers: llugovic, ipaljak, mferencevic

Reviewed By: ipaljak

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2669
2020-02-14 10:00:55 +01:00
Teon Banek
4281a57923 Stub out full Python API for Query Modules
Summary:
This is the Python 3.5+ version of our C API found in
include/mg_procedure.h. It should strive to be simple to use, but very
hard to misuse. The Python API avoids almost all memory management
issues found in the C API, so it is automatically less error prone.

Unfortunately, we cannot avoid the issue of having some objects being
alive only during the execution of a custom procedure. For such objects
we have a `Invalid<Object>Error` exception types. The Python API should
fairly easily check the validity because all such objects are related to
ProcCtx in some way. Our C/C++ part will push 1 instance of ProcCtx each
time a Python procedure is invoked and can therefore easily change
ProcCtx to be invalid. This can be as simple as changing the
implementation pointer of ProcCtx to NULL.

Reviewers: mferencevic, ipaljak, tlastre, dsantl, buda

Reviewed By: mferencevic, tlastre

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2650
2020-02-04 13:10:10 +01:00