Encountering issues with multiqueries ordered by key
Primevenn opened this issue · 0 comments
Primevenn commented
Hi there!
I have encountered an issue trying order by Key where I get the following error:
ValueError: Value protobuf did not have any value set
I've narrowed it down to the _compare
method within _datastore_query.py
It seems it does not cater for ordering by key (order.name=__ key __)
Additionally, looking into helpers._get_value_from_value_pb()
, a Key object is returned for
key_value
properties but they are not compared based on their paths.
Steps to reproduce
- Produce a Multiquery and order by key.
query = (
SomeKind.query()
.order(SomeKind.key)
.filter(ndb.OR(SomeKind.foo == 4, SomeKind.foo == 3, SomeKind.foo == 1))
)
Stack trace
File "/Users/mwolanski001/.virtualenvs/venn/lib/python2.7/site-packages/google/cloud/ndb/query.py", line 1214, in wrapper
return wrapped(self, *dummy_args, _options=query_options)
File "/Users/mwolanski001/.virtualenvs/venn/lib/python2.7/site-packages/google/cloud/ndb/utils.py", line 114, in wrapper
return wrapped(*args, **new_kwargs)
File "/Users/mwolanski001/.virtualenvs/venn/lib/python2.7/site-packages/google/cloud/ndb/utils.py", line 146, in positional_wrapper
return wrapped(*args, **kwds)
File "/Users/mwolanski001/.virtualenvs/venn/lib/python2.7/site-packages/google/cloud/ndb/query.py", line 1736, in fetch
return self.fetch_async(_options=kwargs["_options"]).result()
File "/Users/mwolanski001/.virtualenvs/venn/lib/python2.7/site-packages/google/cloud/ndb/tasklets.py", line 191, in result
self.check_success()
File "/Users/mwolanski001/.virtualenvs/venn/lib/python2.7/site-packages/google/cloud/ndb/tasklets.py", line 138, in check_success
raise self._exception
ValueError: Value protobuf did not have any value set
Thanks for your time!