[BUG] Missing Cypher operators #267
Labels
community
community
Effort - Low
Effort - Low
feature
feature
Frequency - Monthly
Frequency - Monthly
good first issue
good first issue
Priority - Later
Priority - Later
Reach - Some
Reach - Some
Severity - S3
Severity - S3
Environment
Describe the bug
Some Cypher operators are missing from GQLAlchemy implementation.
I need to use the "=~" operator for a pattern matching query but it's not declared in the enumeration :
https://github.com/memgraph/gqlalchemy/blob/main/gqlalchemy/query_builders/declarative_base.py#L84
Sadly, it's not possible to build the query without the enum due to this line :
https://github.com/memgraph/gqlalchemy/blob/main/gqlalchemy/query_builders/declarative_base.py#L184
To Reproduce
Instead of pasting here a lot of my application code, please find below an unstested example adapted from https://memgraph.com/docs/cypher-manual/clauses/where#3-regular-expressions
query = match().node(labels="Person", variable="n").where(item="n.name", operator="=~", literal=".*a$").return("n")
query.execute()
[...] File "/home/philippe/.local/share/virtualenvs/Engine-tgOo-fyU/lib/python3.9/site-packages/gqlalchemy/query_builders/declarative_base.py", line 950, in and_where self._query.append(AndWhereConditionPartialQuery(item=item, operator=operator, **kwargs)) File "/home/philippe/.local/share/virtualenvs/Engine-tgOo-fyU/lib/python3.9/site-packages/gqlalchemy/query_builders/declarative_base.py", line 212, in __init__ super().__init__(item=item, operator=operator, keyword=Where.AND, **kwargs) File "/home/philippe/.local/share/virtualenvs/Engine-tgOo-fyU/lib/python3.9/site-packages/gqlalchemy/query_builders/declarative_base.py", line 172, in __init__ self.query = self._build_where_query(item=item, operator=operator, **kwargs) File "/home/philippe/.local/share/virtualenvs/Engine-tgOo-fyU/lib/python3.9/site-packages/gqlalchemy/query_builders/declarative_base.py", line 186, in _build_where_query raise GQLAlchemyOperatorTypeError(clause=self.type) gqlalchemy.exceptions.GQLAlchemyOperatorTypeError
Expected behavior
A full support by GQLAlchemy of all Cypher operators (and all related syntax)
Additional context
Patching the enum (declared at https://github.com/memgraph/gqlalchemy/blob/main/gqlalchemy/query_builders/declarative_base.py#L84) allows to build and run properly a query containing a regex.
The text was updated successfully, but these errors were encountered: