Closed
Description
this method return an None type
original code like this
# class google.cloud.datastore.query.Query
class Query(object):
........
def add_filter(self, property_name, operator, value):
if self.OPERATORS.get(operator) is None:
error_message = 'Invalid expression: "%s"' % (operator,)
choices_message = "Please use one of: =, <, <=, >, >=."
raise ValueError(error_message, choices_message)
if property_name == "__key__" and not isinstance(value, Key):
raise ValueError('Invalid key: "%s"' % value)
self._filters.append((property_name, operator, value))
This makes it impossible to add filtering and fetch it on one line
Please let it return it self!
Therefore you can code like this:
query_results = client.query(kind='Task').add_filter("name", "=", "something").fetch()
Code modification requires only one line, but this will be of great benefit.