* [T1006-MG < T1017-MG] Add LBA checks to all read procedures in C API (#515)
* Initial Impl
* NextPermittedEdge introduced
* revert moving constructor to cpp
* edge from and edge to methods expanded with lba check
* minor fix
* added check to path expand procedure
* Added integration tests for read query procedures
* additional check
* changed iterator type to reference
* comments from pr
Co-authored-by: Josip Mrden <josip.mrden@memgraph.io>
* [T1006-MG < T1018-MG] Add LBA checks to all update procedures in C API (#516)
* Initial Impl
* NextPermittedEdge introduced
* revert moving constructor to cpp
* edge from and edge to methods expanded with lba check
* minor fix
* extended update methods
* added check to path expand procedure
* Added integration tests for read query procedures
* Added integration tests for update query modules
* additional check
* changed iterator type to reference
* fixed bug in Update property for node; fixed 2 e2e tests
* replaced enum
Co-authored-by: Josip Mrden <josip.mrden@memgraph.io>
* [T1006-MG < T1019-MG] Add LBA checks to all Create and Delete procedures in C API (#517)
* Initial Impl
* NextPermittedEdge introduced
* revert moving constructor to cpp
* edge from and edge to methods expanded with lba check
* minor fix
* extended update methods
* initial implementation
* added check to path expand procedure
* Added integration tests for read query procedures
* Added integration tests for update query modules
* Added unit tests for creation of vertex, adding and removing vertex label
* additional check
* changed iterator type to reference
* Added unit tests for create edge
* Corrected query module in create edge
* fixed bug in Update property for node; fixed 2 e2e tests
* fixed merge errors
* Expanded FineGrainedAuthChecker with HasGlobalPermissionOnVertices and HasGlobalPermissionOnEdges
* Removed two wrong checks; Added two global checks
* return null added
* introduced new mgp_error value
* fixed endless loop
* replaced enum
* intermediate
* tests updated
* PermissionDeniedError -> AuthorizationError rename
* rename in enum permission_denied error -> authorization error
* mgp_vertex_remove_label check improved
* quotes changed; order of imports fixed
* string constant introduced
* import fixed
* yaml format
Co-authored-by: Josip Mrden <josip.mrden@memgraph.io>
Co-authored-by: Josip Mrden <josip.mrden@memgraph.io>
* Extend mgp_module with include adding functions
* Add return type to the function API
* Change Cypher grammar
* Add Python support for functions
* Implement error handling
* E2e tests for functions
* Write cpp e2e functions
* Create mg.functions() procedure
* Implement case insensitivity for user-defined Magic Functions.
* Fix doc of mgp_graph_vertices
* Make write_proc example meaningful write procedure example
* Improve wrap_exceptions
* Add check for write procedures for ReadWriteTypeChecker
* Change error code in case of invalid default value for optional arguments
* Use the correct transformation result type
* Execute the result queries in streams
* Change the result type of parameters to nullable map
* Serialize transformation name
* Fix order of transformation parameters
* Use actual transformation in Streams
* Clear the Python transformations under GIL
* Add CHECK STREAM query
* Handle missing record fields properly
* Add __deepcopy__ for Properties
* Fix Vertices __contains__
* Check the incoming type in Vertex and Edge __eq__
* Add NetworkX support code
* Add NetworkX algorithms
* PageRank is now included in the nxalg module
* Rewrite graph analyzer to use NetworkX support code
* Don't make the error case be the "default" case
Summary:
- Add the `mgp_must_abort(const mgp_graph *graph)` C API.
- Add the `ProcCtx.must_abort()` Python API.
The usage is very simple -- the function returns a boolean indicating whether
the procedure should abort.
Reviewers: mferencevic, dsantl
Reviewed By: mferencevic
Subscribers: pullbot
Differential Revision: https://phabricator.memgraph.io/D2742
Summary:
You should now be able to invoke query procedures written in Python. To
test the example you can run memgraph with PYTHONPATH set to `include`.
For example, assuming you are in the root of the repo, run this command.
PYTHONPATH=$PWD/include ./build/memgraph --query-modules-directory=./query_modules/
Alternatively, you can set a symlink inside the ./query_modules to point
to `include/mgp.py`, so there's no need to set PYTHONPATH. For example,
assuming you are in the root of the repo, run the following.
cd ./query_modules
ln -s ../include/mgp.py
cd ..
./build/memgraph --query-modules-directory=./query_modules/
Depends on D207
Reviewers: mferencevic, ipaljak, dsantl
Reviewed By: ipaljak
Subscribers: buda, tlastre, pullbot
Differential Revision: https://phabricator.memgraph.io/D2708
Summary:
There's no need for so many Exception subclasses, because the root cause
is always the same.
Depends on D2700
Reviewers: mferencevic, ipaljak
Reviewed By: mferencevic, ipaljak
Subscribers: pullbot
Differential Revision: https://phabricator.memgraph.io/D2701
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
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