Exp — Expression Builder¶
Expression builder utilities.
Re-exports FilterExpression as Exp and provides a convenience val() function
for creating value expressions from Python values, plus thin pass-through
wrappers around the 8.1.2 enhanced expression API (in_list / map_keys
/ map_values).
The pass-throughs deliberately have the same signatures as the canonical
FilterExpression factories and do not accept a ctx= kwarg — apply
nested-CDT navigation at the AEL path layer instead (e.g. $.outer.inner).
- aerospike_sdk.exp.Exp¶
alias of
FilterExpression
- aerospike_sdk.exp.val(value)[source]¶
- Overloads:
value (bool) → Exp
value (int) → Exp
value (float) → Exp
value (str) → Exp
value (bytes) → Exp
value (bytearray) → Exp
value (List[Any]) → Exp
value (Dict[Any, Any]) → Exp
value (None) → Exp
Create a value expression from a Python value.
Automatically dispatches to the appropriate FilterExpression method based on the value’s type.
- aerospike_sdk.exp.in_list(value, list_exp)[source]¶
Boolean expression:
valueis an element oflist_exp.Thin wrapper around the native
InListExpOp introduced in server 8.1.2 — a single opcode that is cheaper to pack and to evaluate than the equivalentlist_get_by_value(COUNT) > 0composition used on pre-8.1.2 servers.Requires Aerospike server >= 8.1.2. On older servers the server’s expression VM rejects the opcode at evaluation time. To stay compatible with pre-8.1.2 servers, build the equivalent expression yourself using
Exp.list_get_by_valuewithListReturnType.COUNT.- Parameters:
value (
FilterExpression) – The value to search for.list_exp (
FilterExpression) – A list expression (e.g.Exp.list_bin("tags")).
- Return type:
FilterExpression
Example:
# bin "role" in list bin "allowed_roles" in_list(Exp.string_bin("role"), Exp.list_bin("allowed_roles"))
- aerospike_sdk.exp.map_keys(map_exp)[source]¶
Return the keys of
map_expas a list expression.Thin wrapper around the native
MapKeysExpOp introduced in server 8.1.2 — cheaper to pack and to evaluate than the equivalentmap_get_by_index_range(KEY, 0, ...)composition used on pre-8.1.2 servers.Requires Aerospike server >= 8.1.2. On older servers, build the equivalent expression yourself using
Exp.map_get_by_index_rangewithMapReturnType.KEY.- Parameters:
map_exp (
FilterExpression) – A map expression (e.g.Exp.map_bin("scores")).- Return type:
FilterExpression
Example:
map_keys(Exp.map_bin("scores"))
- aerospike_sdk.exp.map_values(map_exp)[source]¶
Return the values of
map_expas a list expression.Thin wrapper around the native
MapValuesExpOp introduced in server 8.1.2 — cheaper to pack and to evaluate than the equivalentmap_get_by_index_range(VALUE, 0, ...)composition used on pre-8.1.2 servers.Requires Aerospike server >= 8.1.2. On older servers, build the equivalent expression yourself using
Exp.map_get_by_index_rangewithMapReturnType.VALUE.- Parameters:
map_exp (
FilterExpression) – A map expression (e.g.Exp.map_bin("scores")).- Return type:
FilterExpression
Example:
map_values(Exp.map_bin("scores"))