The NDB Datastore forbids multiple inequality queries on different properties. To get around this, I thought that the solution might be to combine the results of multiple independent queries. I found this 2011 question which recommends geohashing, with which I am not familiar. So, perhaps there is a better solution today.
Consider these two queries:
q1 = User.query(User.age < 18).fetch()
q2 = User.query(User.city != 'New York City').fetch()
I attempt to join them like this:
results = set(q1).intersection(q2)
However, I encounter TypeError: Model is not immutable
.
My questions:
- Is there a better way to deal with multiple inequality filters on different properties?
- If not, how can I resolve the
TypeError
above?
Thank you for the assistance.