Skip to content

Commit 3da64fc

Browse files
authored
chore(revert): revert add api for IN/NOT_IN/NOT_EQUAL operators (#286)
This reverts commit be1164d05e50e6a25b6752cbfaeee06e06f8814d.
1 parent cb0a88c commit 3da64fc

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

packages/google-cloud-datastore/google/cloud/datastore/query.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ 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,
9289
}
9390
"""Mapping of operator strings and their protobuf equivalents."""
9491

@@ -218,7 +215,7 @@ def add_filter(self, property_name, operator, value):
218215
219216
where property is a property stored on the entity in the datastore
220217
and operator is one of ``OPERATORS``
221-
(ie, ``=``, ``<``, ``<=``, ``>``, ``>=``, ``!=``, ``IN``, ``NOT_IN``):
218+
(ie, ``=``, ``<``, ``<=``, ``>``, ``>=``):
222219
223220
.. testsetup:: query-filter
224221
@@ -238,7 +235,7 @@ def add_filter(self, property_name, operator, value):
238235
:param property_name: A property name.
239236
240237
:type operator: str
241-
:param operator: One of ``=``, ``<``, ``<=``, ``>``, ``>=``, ``!=``, ``IN``, ``NOT_IN``.
238+
:param operator: One of ``=``, ``<``, ``<=``, ``>``, ``>=``.
242239
243240
:type value: :class:`int`, :class:`str`, :class:`bool`,
244241
:class:`float`, :class:`NoneType`,
@@ -255,7 +252,7 @@ def add_filter(self, property_name, operator, value):
255252
"""
256253
if self.OPERATORS.get(operator) is None:
257254
error_message = 'Invalid expression: "%s"' % (operator,)
258-
choices_message = "Please use one of: =, <, <=, >, >=, !=, IN, NOT_IN."
255+
choices_message = "Please use one of: =, <, <=, >, >=."
259256
raise ValueError(error_message, choices_message)
260257

261258
if property_name == "__key__" and not isinstance(value, Key):
@@ -296,7 +293,7 @@ def key_filter(self, key, operator="="):
296293
:param key: The key to filter on.
297294
298295
:type operator: str
299-
:param operator: (Optional) One of ``=``, ``<``, ``<=``, ``>``, ``>=``, ``!=``, ``IN``, ``NOT_IN``.
296+
:param operator: (Optional) One of ``=``, ``<``, ``<=``, ``>``, ``>=``.
300297
Defaults to ``=``.
301298
"""
302299
self.add_filter("__key__", operator, key)

packages/google-cloud-datastore/google/cloud/datastore_v1/types/query.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,7 @@ class Operator(proto.Enum):
260260
GREATER_THAN = 3
261261
GREATER_THAN_OR_EQUAL = 4
262262
EQUAL = 5
263-
IN = 6
264-
NOT_EQUAL = 9
265263
HAS_ANCESTOR = 11
266-
NOT_IN = 13
267264

268265
property = proto.Field(proto.MESSAGE, number=1, message="PropertyReference",)
269266
op = proto.Field(proto.ENUM, number=2, enum=Operator,)

packages/google-cloud-datastore/tests/unit/test_query.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,12 @@ def test_query_add_filter_w_all_operators():
175175
query.add_filter("lt_prop", "<", "val3")
176176
query.add_filter("gt_prop", ">", "val4")
177177
query.add_filter("eq_prop", "=", "val5")
178-
query.add_filter("in_prop", "IN", ["val6"])
179-
query.add_filter("neq_prop", "!=", "val9")
180-
query.add_filter("not_in_prop", "NOT_IN", ["val13"])
181-
assert len(query.filters) == 8
178+
assert len(query.filters) == 5
182179
assert query.filters[0] == ("leq_prop", "<=", "val1")
183180
assert query.filters[1] == ("geq_prop", ">=", "val2")
184181
assert query.filters[2] == ("lt_prop", "<", "val3")
185182
assert query.filters[3] == ("gt_prop", ">", "val4")
186183
assert query.filters[4] == ("eq_prop", "=", "val5")
187-
assert query.filters[5] == ("in_prop", "IN", ["val6"])
188-
assert query.filters[6] == ("neq_prop", "!=", "val9")
189-
assert query.filters[7] == ("not_in_prop", "NOT_IN", ["val13"])
190184

191185

192186
def test_query_add_filter_w_known_operator_and_entity():

0 commit comments

Comments
 (0)