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

Datastore - Support for OR predicate in GQL/Query Filters #1364

Closed
sai-pullabhotla opened this issue Nov 2, 2016 · 5 comments
Closed

Datastore - Support for OR predicate in GQL/Query Filters #1364

sai-pullabhotla opened this issue Nov 2, 2016 · 5 comments
Assignees
Labels
api: datastore Issues related to the Datastore API.

Comments

@sai-pullabhotla
Copy link

Is there a reason why a datastore query (GQL or otherwise) does not allow OR predicate? I noticed that the AppEngine Datastore supports this -

(https://cloud.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/Query.CompositeFilter).

I was under the impression that Cloud Datastore is similar (or same) as AppEngine Datastore.

In any case, is this some thing that can be supported?

@mziccard
Copy link
Contributor

mziccard commented Nov 2, 2016

@aozarov @ajkannan Any reason we don't support OR?

@mziccard mziccard added the api: datastore Issues related to the Datastore API. label Nov 2, 2016
@ajkannan
Copy link

ajkannan commented Nov 2, 2016

It looks like "OR" isn't supported in Cloud Datastore yet.

Looking at the current cloud docs and previous cloud docs, I don't see "or" mentioned under composite filter operators, just "and". Also, this page and this page (in the "where" row) affirm that only "and" is supported for now.

/cc @eddavisson are there plans to support "OR" in Cloud Datastore?

@sai-pullabhotla
Copy link
Author

@ajkannan - This page clearly states that -

Restrictions on queries

The nature of the index query mechanism imposes certain restrictions on what a query can do. Cloud Datastore queries do not support substring matches, case-insensitive matches, or so-called full-text search. The NOT, OR, and != operators are not natively supported, but some client libraries may add support on top of Cloud Datastore.

I wonder if any of the client libraries (possibly Python or the AppEngine Java API) do this, and if so, how do they do it? Something to look into.

@mziccard
Copy link
Contributor

mziccard commented Nov 3, 2016

@sai-pullabhotla I can confirm that OR is not supported natively. And yes, some clients (AppEngine SDK and python ndb) support OR by issuing multiple queries and then merging the results. Such a feature is out of the scope of our client which is meant to be a java-idiomatic but thin layer on top of Datastore API. AFAIK none of the other google-cloud-* libraries supports OR.

@sai-pullabhotla
Copy link
Author

@mziccard - Thanks. I just wanted to make sure if this is something the Datastore supports or not. Now we know the answer. I'm closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the Datastore API.
Projects
None yet
Development

No branches or pull requests

3 participants