memgraph / gqlalchemy

GQLAlchemy is a library developed with the purpose of assisting in writing and running queries on Memgraph. GQLAlchemy supports high-level connection to Memgraph as well as modular query builder.

Home Page:https://pypi.org/project/gqlalchemy/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Call method from query builder is not working well with string as procedure argument

katarinasupe opened this issue · comments

The call method from the query builder is constructing the query with procedure argument as stated in its docstring:

Python: call('json_util.load_from_url', 'https://some-url.com').yield_('objects').return_(results='objects').execute()
Cypher: CALL json_util.load_from_url(https://some-url.com) YIELD objects RETURN objects;

(docstring is also not written well and it is not generating correctly in the reference guide)

But, this is not correct, since json_util.load_from_url has string argument. The correct query would be:
CALL json_util.load_from_url('https://some-url.com') YIELD objects RETURN objects;

Hence, if the procedure argument is a string, quotes should be around it. There is no test for this case currently.

Closing this, it works with:

call(
    "json_util.load_from_url",
    "'https://download.memgraph.com/asset/mage/data.json'",
)
.yield_("objects")
.return_(results="objects")
.execute()

but, the docstring should be fixed. (I can do that)