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.

Parameters:

value (Any) – A Python value (bool, int, float, str, bytes, list, dict, or None)

Returns:

A FilterExpression representing the value.

Raises:

TypeError – If the value type is not supported.

aerospike_sdk.exp.in_list(value, list_exp)[source]

Boolean expression: value is an element of list_exp.

Thin wrapper around the native InList ExpOp introduced in server 8.1.2 — a single opcode that is cheaper to pack and to evaluate than the equivalent list_get_by_value(COUNT) > 0 composition 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_value with ListReturnType.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_exp as a list expression.

Thin wrapper around the native MapKeys ExpOp introduced in server 8.1.2 — cheaper to pack and to evaluate than the equivalent map_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_range with MapReturnType.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_exp as a list expression.

Thin wrapper around the native MapValues ExpOp introduced in server 8.1.2 — cheaper to pack and to evaluate than the equivalent map_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_range with MapReturnType.VALUE.

Parameters:

map_exp (FilterExpression) – A map expression (e.g. Exp.map_bin("scores")).

Return type:

FilterExpression

Example:

map_values(Exp.map_bin("scores"))