CDT Read Builders

class aerospike_sdk.aio.operations.cdt_read.CdtReadBuilder[source]

Bases: Generic[T]

Terminal read actions and singular navigation for a CDT path.

The parent (type T) must expose add_operation(op) so the builder can register the produced operation before returning it.

Navigation fields (bin_name, ctx, to_ctx) are optional; when not provided, further navigation is not available (terminal-only).

Example

Read values from a map key within a query:

stream = await (
    session.query(key)
        .bin("settings").on_map_key("theme").get_values()
        .execute()
)
__init__(parent, op_factory, return_type_cls, *, is_map, bin_name='', ctx=(), to_ctx=None)[source]
on_map_key(key, *, create_type=None)[source]

Navigate into a map element by key.

Parameters:
  • key (Any) – Map key to target.

  • create_type (Optional[MapOrder]) – If set, use a create-on-missing context for this key with the given map key order.

Return type:

CdtReadBuilder[TypeVar(T)]

Returns:

CdtReadBuilder for reading the targeted element.

Example::

.bin(“m”).on_map_key(“x”).get_values()

on_map_index(index)[source]

Navigate into a map element by index.

Parameters:

index (int) – Map index to target.

Return type:

CdtReadBuilder[TypeVar(T)]

Returns:

CdtReadBuilder for reading the targeted element.

on_map_rank(rank)[source]

Navigate into a map element by rank (0 = lowest value).

Parameters:

rank (int) – Rank position (0 = lowest value).

Return type:

CdtReadBuilder[TypeVar(T)]

Returns:

CdtReadBuilder for reading the targeted element.

on_list_index(index, *, order=None, pad=False)[source]

Navigate into a list element by index.

Parameters:
  • index (int) – List index (0-based, negative counts from end).

  • order (Optional[ListOrderType]) – If set (or if pad is True), use create-on-missing list context with this order; when only pad is True, defaults to UNORDERED.

  • pad (bool) – When using create-on-missing context, allow sparse indexes.

Return type:

CdtReadBuilder[TypeVar(T)]

Returns:

CdtReadBuilder for reading the targeted element.

Example::

.bin(“items”).on_list_index(0).get_values()

on_list_rank(rank)[source]

Navigate into a list element by rank (0 = lowest value).

Parameters:

rank (int) – Rank position (0 = lowest value).

Return type:

CdtReadBuilder[TypeVar(T)]

Returns:

CdtReadBuilder for reading the targeted element.

on_map_value(value)[source]

Navigate into map elements matching a value (may match multiple).

Parameters:

value (Any) – Value to match.

Return type:

CdtReadInvertableBuilder[TypeVar(T)]

Returns:

CdtReadInvertableBuilder for reading the selection; further singular navigation is supported when this builder was produced from a nested path.

on_map_index_range(index, count=None)[source]

Navigate into map elements by index range.

Return type:

CdtReadInvertableBuilder[TypeVar(T)]

on_map_key_range(start, end)[source]

Navigate into map elements by key range [start, end).

Return type:

CdtReadInvertableBuilder[TypeVar(T)]

on_map_rank_range(rank, count=None)[source]

Navigate into map elements by rank range.

Return type:

CdtReadInvertableBuilder[TypeVar(T)]

on_map_value_range(start, end)[source]

Navigate into map elements by value range [start, end).

Return type:

CdtReadInvertableBuilder[TypeVar(T)]

on_map_key_relative_index_range(key, index, count=None)[source]

Navigate into map entries by index range relative to an anchor key.

Return type:

CdtReadInvertableBuilder[TypeVar(T)]

on_map_value_relative_rank_range(value, rank, count=None)[source]

Navigate into map entries by value rank range relative to an anchor.

Return type:

CdtReadInvertableBuilder[TypeVar(T)]

on_map_key_list(keys)[source]

Navigate into map elements matching a list of keys.

Return type:

CdtReadInvertableBuilder[TypeVar(T)]

on_map_value_list(values)[source]

Navigate into map elements matching a list of values.

Return type:

CdtReadInvertableBuilder[TypeVar(T)]

on_list_value(value)[source]

Navigate into list elements matching a value.

Return type:

CdtReadInvertableBuilder[TypeVar(T)]

on_list_index_range(index, count=None)[source]

Navigate into list elements by index range.

Return type:

CdtReadInvertableBuilder[TypeVar(T)]

on_list_rank_range(rank, count=None)[source]

Navigate into list elements by rank range.

Return type:

CdtReadInvertableBuilder[TypeVar(T)]

on_list_value_range(start, end)[source]

Navigate into list elements by value range [start, end).

Return type:

CdtReadInvertableBuilder[TypeVar(T)]

on_list_value_relative_rank_range(value, rank, count=None)[source]

Navigate into list elements by value rank range relative to anchor.

Return type:

CdtReadInvertableBuilder[TypeVar(T)]

on_list_value_list(values)[source]

Navigate into list elements matching a list of values.

Return type:

CdtReadInvertableBuilder[TypeVar(T)]

get_values()[source]

Return value(s) at the current CDT selection.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

Example::

.bin(“m”).on_map_key(“x”).get_values()

get_keys()[source]

Return map keys at the current CDT selection.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

get_keys_and_values()[source]

Return map key-value pairs at the current CDT selection.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

count()[source]

Return the count of elements at the current CDT selection.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

get_indexes()[source]

Return indexes of the selected CDT elements.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

get_reverse_indexes()[source]

Return reverse indexes of the selected CDT elements.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

get_ranks()[source]

Return ranks of the selected CDT elements.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

get_reverse_ranks()[source]

Return reverse ranks of the selected CDT elements.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

exists()[source]

Check whether the selected CDT element(s) exist.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

map_size()[source]

Return the element count of the map at the current CDT path.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

list_size()[source]

Return the element count of the list at the current CDT path.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

list_get(index)[source]

Read the list element at index at the current CDT path.

Return type:

TypeVar(T)

list_get_range(index, count=None)[source]

Read a slice of the list starting at index (through end if count is None).

Return type:

TypeVar(T)

class aerospike_sdk.aio.operations.cdt_read.CdtReadInvertableBuilder[source]

Bases: CdtReadBuilder[T]

Terminal read actions with inverted (all-others) variants.

Used for range and list selectors where INVERTED makes semantic sense (e.g. “all keys except those in this range”). When constructed with to_ctx set (e.g. after a singular value selector on a nested path), singular navigation methods continue the CDT path.

Example

Get all map values except those in a key range:

.bin("m").on_map_key_range("a", "d").get_all_other_values()
__init__(parent, op_factory, return_type_cls, *, is_map, bin_name='', ctx=(), to_ctx=None)[source]
get_all_other_values()[source]

Return all values except those matching the selection (INVERTED).

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

get_all_other_keys()[source]

Return all map keys except those matching the selection.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

get_all_other_keys_and_values()[source]

Return all map key-value pairs except those matching the selection.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

count_all_others()[source]

Return the count of elements except those matching the selection.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

get_all_other_indexes()[source]

Return indexes of all elements except those matching the selection.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

get_all_other_reverse_indexes()[source]

Return reverse indexes of all elements except those matching the selection.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

get_all_other_ranks()[source]

Return ranks of all elements except those matching the selection.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.

get_all_other_reverse_ranks()[source]

Return reverse ranks of all elements except those matching the selection.

Return type:

TypeVar(T)

Returns:

The parent builder for chaining.