@@ -72,6 +72,7 @@ def _has_key_predicate(path, root_column=None, negated=False, as_path=False):
72
72
return result
73
73
74
74
75
+ @property
75
76
def has_key_check_simple_expression (self ):
76
77
rhs = [self .rhs ] if not isinstance (self .rhs , (list , tuple )) else self .rhs
77
78
return self .is_simple_column and all (key .isalnum () for key in rhs )
@@ -147,7 +148,7 @@ def key_transform_in(self, compiler, connection, as_path=False):
147
148
Return MQL to check if a JSON path exists and that its values are in the
148
149
set of specified values (rhs).
149
150
"""
150
- if as_path and self .is_simple_expression ():
151
+ if as_path and self .can_use_path ():
151
152
return builtin_lookup_path (self , compiler , connection )
152
153
153
154
lhs_mql = process_lhs (self , compiler , connection )
@@ -226,6 +227,7 @@ def key_transform_numeric_lookup_mixin_path(self, compiler, connection):
226
227
return builtin_lookup_path (self , compiler , connection )
227
228
228
229
230
+ @property
229
231
def keytransform_is_simple_column (self ):
230
232
previous = self
231
233
while isinstance (previous , KeyTransform ):
@@ -242,11 +244,11 @@ def register_json_field():
242
244
HasKey .mongo_operator = None
243
245
HasKeyLookup .as_mql_path = partialmethod (has_key_lookup , as_path = True )
244
246
HasKeyLookup .as_mql_expr = partialmethod (has_key_lookup , as_path = False )
245
- HasKeyLookup .is_simple_expression = has_key_check_simple_expression
247
+ HasKeyLookup .can_use_path = has_key_check_simple_expression
246
248
HasKeys .mongo_operator = "$and"
247
249
JSONExact .process_rhs = json_exact_process_rhs
248
- KeyTransform .is_simple_column = property ( keytransform_is_simple_column )
249
- KeyTransform .is_simple_expression = keytransform_is_simple_column
250
+ KeyTransform .is_simple_column = keytransform_is_simple_column
251
+ KeyTransform .can_use_path = keytransform_is_simple_column
250
252
KeyTransform .as_mql_path = partialmethod (key_transform , as_path = True )
251
253
KeyTransform .as_mql_expr = partialmethod (key_transform , as_path = False )
252
254
KeyTransformExact .as_mql_expr = key_transform_exact_expr
0 commit comments