@@ -86,6 +86,9 @@ class Query(object):
8686"<" :query_pb2 .PropertyFilter .Operator .LESS_THAN ,
8787">" :query_pb2 .PropertyFilter .Operator .GREATER_THAN ,
8888"=" :query_pb2 .PropertyFilter .Operator .EQUAL ,
89+ "!=" :query_pb2 .PropertyFilter .Operator .NOT_EQUAL ,
90+ "IN" :query_pb2 .PropertyFilter .Operator .IN ,
91+ "NOT_IN" :query_pb2 .PropertyFilter .Operator .NOT_IN ,
8992 }
9093"""Mapping of operator strings and their protobuf equivalents."""
9194
@@ -215,7 +218,7 @@ def add_filter(self, property_name, operator, value):
215218
216219 where property is a property stored on the entity in the datastore
217220 and operator is one of ``OPERATORS``
218- (ie, ``=``, ``<``, ``<=``, ``>``, ``>=``):
221+ (ie, ``=``, ``<``, ``<=``, ``>``, ``>=``, ``!=``, ``IN``, ``NOT_IN`` ):
219222
220223 .. testsetup:: query-filter
221224
@@ -235,7 +238,7 @@ def add_filter(self, property_name, operator, value):
235238 :param property_name: A property name.
236239
237240 :type operator: str
238- :param operator: One of ``=``, ``<``, ``<=``, ``>``, ``>=``.
241+ :param operator: One of ``=``, ``<``, ``<=``, ``>``, ``>=``, ``!=``, ``IN``, ``NOT_IN`` .
239242
240243 :type value: :class:`int`, :class:`str`, :class:`bool`,
241244 :class:`float`, :class:`NoneType`,
@@ -252,7 +255,7 @@ def add_filter(self, property_name, operator, value):
252255 """
253256if self .OPERATORS .get (operator )is None :
254257error_message = 'Invalid expression: "%s"' % (operator ,)
255- choices_message = "Please use one of: =, <, <=, >, >=."
258+ choices_message = "Please use one of: =, <, <=, >, >=, !=, IN, NOT_IN ."
256259raise ValueError (error_message ,choices_message )
257260
258261if property_name == "__key__" and not isinstance (value ,Key ):
@@ -293,7 +296,7 @@ def key_filter(self, key, operator="="):
293296 :param key: The key to filter on.
294297
295298 :type operator: str
296- :param operator: (Optional) One of ``=``, ``<``, ``<=``, ``>``, ``>=``.
299+ :param operator: (Optional) One of ``=``, ``<``, ``<=``, ``>``, ``>=``, ``!=``, ``IN``, ``NOT_IN`` .
297300 Defaults to ``=``.
298301 """
299302self .add_filter ("__key__" ,operator ,key )