SyncRecordStream

class aerospike_sdk.sync.record_stream.SyncRecordStream[source]

Bases: object

Blocking view of RecordStream.

Iterator protocol and helpers (first, collect, …) call into the underlying async stream via the parent client’s event-loop manager, so each step may block the calling thread until data is ready.

Behavior vs async: Ordering and per-row semantics match RecordStream; only the API surface is synchronous. close() closes the async stream directly without crossing the loop (releases resources; pending async iteration should stop).

Example:

with SyncClient("localhost:3000") as client:
    session = client.create_session()
    for row in session.query(ns, set).bins(["name"]).execute():
        if row.record:
            print(row.record.bins)

See also

RecordStream

__init__(stream, loop_manager)[source]

Wrap stream for synchronous consumption (internal use).

first()[source]

Return the first row, or None if the stream is empty.

See also

first()

Return type:

RecordResult | None

first_or_raise()[source]

Return the first row or raise if the stream is empty or not OK.

Raises:

AerospikeError – On a failed row or empty-stream error from the async layer. See first_or_raise().

Return type:

RecordResult

first_udf_result()[source]

Return the first non-None udf_result.

Return type:

Any | None

collect()[source]

Drain the stream into a list (blocks until complete).

Return type:

list[RecordResult]

failures()[source]

Collect rows whose result_code is not OK.

Return type:

list[RecordResult]

close()[source]

Release the underlying async stream.

Return type:

None