New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditional execution procedures #203
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, very clean solution I really don't see many things that could be improved. However, some e2e tests are failing so you chekc this + please mention the comment about built, Python and gqla on the daily, we should discuss that.
I think it would be good if you can provide some real queries for conditions not just true/false so we have "real" e2e example, e.g match on some person check some condition and then do something with it. |
Also, I think it would be good to test the behavior when there are no output values from do.case and do.when, e.g you user enter do.case and provides some query which doesn't yield any values so those empty values are sent into the other module/query and shouldn't do anything because there are none of them. |
Also, can you the behavior of checking the string property value, when it has quotes? Like this: MATCH (n) WHERE n.id = "hello" RETURN n; |
Will do. The check only failed because igraph e2e tests don’t make sure the database is empty - I’ll update the e2e script to do that before each test. No problem - I only omitted such tests because evaluating the condition to true/false is the query engine’s job. Good idea, I’ll add a test 👍 Do you mean strings that contain quote marks inside them? |
yes |
python/do.py
Outdated
return [ | ||
mgp.Record( | ||
value={ | ||
field_name: _gqlalchemy_type_to_mgp(ctx.graph, field_value) | ||
for field_name, field_value in result.items() | ||
} | ||
) | ||
for result in results | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not also _convert_results?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks!
python/utils/subquery.py
Outdated
|
||
|
||
def is_global_operation(subquery: str) -> bool: | ||
return any(subquery.startswith(pattern) for pattern in QUERY_PATTERNS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should support also lower case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
I would like to add one more thing if you think it makes sense and that is testing whole vertex and relationship objects return result, not just size of the returned results so we are sure vertex and relationships are correctly returned from gqla to mage. |
This makes sense, added one test each for nodes, relationships and paths that make use of their peculiarities (node properties, |
[BUG] Failed do.when() when using database with authentication |
Description
This PR adds a query module that allows conditional execution of read-only procedures.
Pull request type
######################################
Reviewer checklist (the reviewer checks this part)
Module/Algorithm
######################################