Exp — Expression Builder

Expression builder utilities.

Re-exports FilterExpression as Exp and provides a convenience val() function for creating value expressions from Python values.

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, ctx=None)[source]

Check whether value exists in list_exp.

Returns a boolean expression equivalent to value IN list.

Parameters:
  • value (FilterExpression) – The value to search for.

  • list_exp (FilterExpression) – A list expression (e.g. Exp.list_bin("tags")).

  • ctx (Optional[List[CTX]]) – Optional CDT context for nested lists.

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, ctx=None)[source]

Return all keys of map_exp as a list expression.

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

  • ctx (Optional[List[CTX]]) – Optional CDT context for nested maps.

Return type:

FilterExpression

Example:

map_keys(Exp.map_bin("scores"))
aerospike_sdk.exp.map_values(map_exp, ctx=None)[source]

Return all values of map_exp as a list expression.

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

  • ctx (Optional[List[CTX]]) – Optional CDT context for nested maps.

Return type:

FilterExpression

Example:

map_values(Exp.map_bin("scores"))