SyncWriteSegmentBuilder

class aerospike_sdk.sync.operations.query.SyncWriteSegmentBuilder[source]

Bases: _SyncWriteVerbs

Synchronous multi-key write segment (mirrors WriteSegmentBuilder).

Bin scalars, CDT, expressions, and policies delegate to the embedded async segment; execute() returns SyncRecordStream.

__init__(wsb, loop_manager)[source]
bin(bin_name)[source]

Start a bin-level write operation.

Return type:

SyncWriteBinBuilder

add_operation(op)[source]

Append an operation (used by CDT action builders).

Return type:

None

put(bins)[source]

Set multiple bins at once.

Return type:

SyncWriteSegmentBuilder

set_bins(bins)[source]

Alias for put().

Return type:

SyncWriteSegmentBuilder

set_to(bin_name, value)[source]

Set a bin to value.

Return type:

SyncWriteSegmentBuilder

add(bin_name, value)[source]

Add a numeric value to a bin.

Return type:

SyncWriteSegmentBuilder

increment_by(bin_name, value)[source]

Alias for add().

Return type:

SyncWriteSegmentBuilder

get(bin_name)[source]

Read a bin value back within a write operate.

Return type:

SyncWriteSegmentBuilder

append(bin_name, value)[source]

Append a string to a bin.

Return type:

SyncWriteSegmentBuilder

prepend(bin_name, value)[source]

Prepend a string to a bin.

Return type:

SyncWriteSegmentBuilder

remove_bin(bin_name)[source]

Delete a bin from the record.

Return type:

SyncWriteSegmentBuilder

delete_record()[source]

Add a record-level delete to the current operate call.

Unlike delete() which targets a different key, this deletes the record being operated on as part of the same atomic operation.

Example:

stream = (
    session.upsert(key)
        .bin("name").get()
        .delete_record()
        .execute()
)
Return type:

SyncWriteSegmentBuilder

Returns:

This segment for chaining.

See also

delete(): Start a new delete segment for a key.

touch_record()[source]

Add a record-level touch to the current operate call.

Resets the record’s TTL as part of an atomic multi-operation call. Combine with expire_record_after_seconds() to set a new TTL.

Example:

stream = (
    session.upsert(key)
        .bin("score").get()
        .touch_record()
        .expire_record_after_seconds(120)
        .execute()
)
Return type:

SyncWriteSegmentBuilder

Returns:

This segment for chaining.

See also

touch(): Start a new touch segment for a key.

select_from(bin_name, expression, *, ignore_eval_failure=False)[source]

Read a computed value into a bin using an AEL expression.

Return type:

SyncWriteSegmentBuilder

insert_from(bin_name, expression, *, ignore_op_failure=False, ignore_eval_failure=False, delete_if_null=False)[source]

Write expression result only if bin does not already exist.

Return type:

SyncWriteSegmentBuilder

update_from(bin_name, expression, *, ignore_op_failure=False, ignore_eval_failure=False, delete_if_null=False)[source]

Write expression result only if bin already exists.

Return type:

SyncWriteSegmentBuilder

upsert_from(bin_name, expression, *, ignore_op_failure=False, ignore_eval_failure=False, delete_if_null=False)[source]

Write expression result, creating or overwriting the bin.

Return type:

SyncWriteSegmentBuilder

query(arg1, *more_keys)[source]

Finalize current write segment and start a read segment.

Return type:

SyncQueryBuilder

where(expression)[source]

Set a filter expression on the current write segment.

Return type:

SyncWriteSegmentBuilder

expire_record_after_seconds(seconds)[source]

Set the TTL on the current write segment.

Return type:

SyncWriteSegmentBuilder

never_expire()[source]

Set this record to never expire (TTL = -1).

Return type:

SyncWriteSegmentBuilder

with_no_change_in_expiration()[source]

Preserve the record’s existing TTL (TTL = -2).

Return type:

SyncWriteSegmentBuilder

expiry_from_server_default()[source]

Use the namespace’s default TTL for this record (TTL = 0).

Return type:

SyncWriteSegmentBuilder

ensure_generation_is(generation)[source]

Set expected generation for optimistic locking.

Return type:

SyncWriteSegmentBuilder

durably_delete()[source]

Enable durable delete on the current segment.

Return type:

SyncWriteSegmentBuilder

respond_all_keys()[source]

Include results for missing keys in the stream.

Return type:

SyncWriteSegmentBuilder

fail_on_filtered_out()[source]

Mark filtered-out records with FILTERED_OUT result code.

Return type:

SyncWriteSegmentBuilder

replace_only()[source]

Change the current segment to replace-if-exists semantics.

Return type:

SyncWriteSegmentBuilder

execute(on_error=None)[source]

Flush accumulated write operations and return a synchronous result stream.

Parameters:

on_error (Union[ErrorStrategy, Callable[[Key, int, AerospikeError], None], None]) – Same as SyncQueryBuilder.execute().

Return type:

SyncRecordStream

Returns:

SyncRecordStream.

See also

execute()