Skip to content
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

Problem with And operator #42

Closed
fanavarro opened this issue Sep 29, 2020 · 2 comments
Closed

Problem with And operator #42

fanavarro opened this issue Sep 29, 2020 · 2 comments

Comments

@fanavarro
Copy link

Hi, I am trying to concatenate several filters in the where clause through And conditions, but I am getting a strange NULL in the middle of the query. For example:

builder = Pypher()
builder.Where.node('procedure').rel_out(labels='type').node(labels='A')
builder.And.node('procedure').rel_out(labels='type').node(labels='B')
print(str(builder))

Is resulting on:
WHERE (procedure)-[:type]->(:A) AND NULL(procedure)-[:type]->(:B)

How can I avoid this NULL appearing after the AND keyword?

Greetings!

@emehrkay
Copy link
Owner

AND is an operator and must be called with parens. https://github.com/emehrkay/Pypher#operators

builder.AND(__.node('procedure')).rel_out(labels='type').node(...)

The reason you're seeing NULL is because it is finding the And class and is looking for a static property that doesnt exist on it

@fanavarro
Copy link
Author

Ok, thanks @emehrkay. I was a little bit confused because the OR condition did not include that NULL when using it in that way. Everything clear now, thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants