Options

Analytics

Binary

AppendOptions

class couchbase.options.AppendOptions(timeout=None, durability=None, cas=None, span=None)

Available options to for a binary append operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:
  • cas (int, optional) – If specified, indicates that operation should be failed if the CAS has changed from this value, indicating that the document has changed.

  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • durability (DurabilityType, optional) – Specifies the level of durability for this operation.

DecrementOptions

class couchbase.options.DecrementOptions(timeout=None, expiry=None, durability=None, delta=None, initial=None, span=None)

Available options to for a decrement append operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • durability (DurabilityType, optional) – Specifies the level of durability for this operation.

  • delta (DeltaValue, optional) – The amount to increment the key. Defaults to 1.

  • initial (SignedInt64, optional) – The initial value to use for the document if it does not already exist. Setting it to a negative value means that the document will not be created if it does not exist. Defaults to 0.

IncrementOptions

class couchbase.options.IncrementOptions(timeout=None, expiry=None, durability=None, delta=None, initial=None, span=None)

Available options to for a binary increment operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • durability (DurabilityType, optional) – Specifies the level of durability for this operation.

  • delta (DeltaValue, optional) – The amount to increment the key. Defaults to 1.

  • initial (SignedInt64, optional) – The initial value to use for the document if it does not already exist. Setting it to a negative value means that the document will not be created if it does not exist. Defaults to 0.

PrependOptions

class couchbase.options.PrependOptions(timeout=None, durability=None, cas=None, span=None)

Available options to for a binary prepend operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:
  • cas (int, optional) – If specified, indicates that operation should be failed if the CAS has changed from this value, indicating that the document has changed.

  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • durability (DurabilityType, optional) – Specifies the level of durability for this operation.

Binary Multi

AppendMultiOptions

class couchbase.options.AppendMultiOptions(timeout=None, durability=None, cas=None, span=None, per_key_options=None, return_exceptions=None)

Available options to for a binary multi-append operation.

Options can be set at a global level (i.e. for all append operations handled with this multi-append operation). Use per_key_options to set specific AppendOptions for specific keys.

Parameters:
  • cas (int, optional) – If specified, indicates that operation should be failed if the CAS has changed from this value, indicating that the document has changed.

  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • durability (DurabilityType, optional) – Specifies the level of durability for this operation.

  • per_key_options (Dict[str, AppendOptions], optional) – Specify AppendOptions per key.

  • return_exceptions (bool, optional) – If False, raise an Exception when encountered. If True return the Exception without raising. Defaults to True.

DecrementMultiOptions

class couchbase.options.DecrementMultiOptions(timeout=None, durability=None, delta=None, initial=None, span=None, per_key_options=None, return_exceptions=None)

Available options to for a binary multi-decrement operation.

Options can be set at a global level (i.e. for all decrement operations handled with this multi-decrement operation). Use per_key_options to set specific DecrementOptions for specific keys.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • durability (DurabilityType, optional) – Specifies the level of durability for this operation.

  • delta (DeltaValue, optional) – The amount to decrement the key. Defaults to 1.

  • initial (SignedInt64, optional) – The initial value to use for the document if it does not already exist. Defaults to 0.

  • per_key_options (Dict[str, DecrementOptions], optional) – Specify DecrementOptions per key.

  • return_exceptions (bool, optional) – If False, raise an Exception when encountered. If True return the Exception without raising. Defaults to True.

IncrementMultiOptions

class couchbase.options.IncrementMultiOptions(timeout=None, durability=None, delta=None, initial=None, span=None, per_key_options=None, return_exceptions=None)

Available options to for a binary multi-increment operation.

Options can be set at a global level (i.e. for all increment operations handled with this multi-increment operation). Use per_key_options to set specific IncrementOptions for specific keys.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • durability (DurabilityType, optional) – Specifies the level of durability for this operation.

  • delta (DeltaValue, optional) – The amount to increment the key. Defaults to 1.

  • initial (SignedInt64, optional) – The initial value to use for the document if it does not already exist. Defaults to 0.

  • per_key_options (Dict[str, IncrementOptions], optional) – Specify IncrementOptions per key.

  • return_exceptions (bool, optional) – If False, raise an Exception when encountered. If True return the Exception without raising. Defaults to True.

PrependMultiOptions

class couchbase.options.PrependMultiOptions(timeout=None, durability=None, cas=None, span=None, per_key_options=None, return_exceptions=None)

Available options to for a binary multi-prepend operation.

Options can be set at a global level (i.e. for all prepend operations handled with this multi-prepend operation). Use per_key_options to set specific PrependOptions for specific keys.

Parameters:
  • cas (int, optional) – If specified, indicates that operation should be failed if the CAS has changed from this value, indicating that the document has changed.

  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • durability (DurabilityType, optional) – Specifies the level of durability for this operation.

  • per_key_options (Dict[str, PrependOptions], optional) – Specify PrependOptions per key.

  • return_exceptions (bool, optional) – If False, raise an Exception when encountered. If True return the Exception without raising. Defaults to True.

Cluster

ClusterOptions

class couchbase.options.ClusterOptions(authenticator, timeout_options=None, tracing_options=None, enable_tls=None, enable_mutation_tokens=None, enable_tcp_keep_alive=None, ip_protocol=None, enable_dns_srv=None, show_queries=None, enable_unordered_execution=None, enable_clustermap_notification=None, enable_compression=None, enable_tracing=None, enable_metrics=None, network=None, tls_verify=None, serializer=None, transcoder=None, tcp_keep_alive_interval=None, config_poll_interval=None, config_poll_floor=None, max_http_connections=None, user_agent_extra=None, logging_meter_emit_interval=None, transaction_config=None, log_redaction=None, compression=None, compression_min_size=None, compression_min_ratio=None, lockmode=None, tracer=None, meter=None, dns_nameserver=None, dns_port=None, disable_mozilla_ca_certificates=None, dump_configuration=None)

Available options to set when creating a cluster.

Warning

Importing options from couchbase.cluster is deprecated. All options should be imported from couchbase.options.

Cluster options enable the configuration of various global cluster settings. Some options can be set globally for the cluster, but overridden for specific operations (i.e. ClusterTimeoutOptions)

Note

The authenticator is mandatory, all the other cluster options are optional.

Parameters:
  • authenticator (Union[PasswordAuthenticator, CertificateAuthenticator]) – An authenticator instance

  • timeout_options (ClusterTimeoutOptions) – Timeout options for various SDK operations. See ClusterTimeoutOptions for details.

  • tracing_options (ClusterTimeoutOptions) – Tracing options for SDK tracing bevavior. See ClusterTracingOptions for details. These are ignored if an external tracer is specified.

  • enable_tls (bool, optional) – Set to True to enable tls. Defaults to False (disabled).

  • enable_mutation_tokens (bool, optional) – Set to False to disable mutation tokens in mutation results. Defaults to True (enabled).

  • enable_tcp_keep_alive (bool, optional) – Set to False to disable tcp keep alive. Defaults to True (enabled).

  • ip_protocol (Union[str, IpProtocol) – Set IP protocol. Defaults to IpProtocol.Any.

  • enable_dns_srv (bool, optional) – Set to False to disable DNS SRV. Defaults to True (enabled).

  • show_queries (bool, optional) – Set to True to enabled showing queries. Defaults to False (disabled).

  • enable_unordered_execution (bool, optional) – Set to False to disable unordered query execution. Defaults to True (enabled).

  • enable_clustermap_notification (bool, optional) – Set to False to disable cluster map notification. Defaults to True (enabled).

  • enable_compression (bool, optional) – Set to False to disable compression. Defaults to True (enabled).

  • enable_tracing (bool, optional) – Set to False to disable tracing (enables no-op tracer). Defaults to True (enabled).

  • enable_metrics (bool, optional) – Set to False to disable metrics (enables no-op meter). Defaults to True (enabled).

  • network (str, optional) – Set network resolution method. Can be set to ‘default’ (if the client is running on the same network as the server) or ‘external’ (if the client is running on a different network). Defaults to ‘auto’.

  • tls_verify (Union[str, TLSVerifyMode], optional) – Set tls verify mode. Defaults to TLSVerifyMode.PEER.

  • disable_mozilla_ca_certificates (bool, optional) – Set to True to disable loading Mozilla’s list of CA certificates for TLS verification. Defaults to False (enabled).

  • serializer (Serializer, optional) – Global serializer to translate JSON to Python objects. Defaults to DefaultJsonSerializer.

  • transcoder (Transcoder, optional) – Global transcoder to use for kv-operations. Defaults to JsonTranscoder.

  • tcp_keep_alive_interval (timedelta, optional) – TCP keep-alive interval. Defaults to None.

  • config_poll_interval (timedelta, optional) – Config polling floor interval. Defaults to None.

  • config_poll_floor (timedelta, optional) – Config polling floor interval. Defaults to None.

  • max_http_connections (int, optional) – Maximum number of HTTP connections. Defaults to None.

  • logging_meter_emit_interval (timedelta, optional) – Logging meter emit interval. Defaults to 10 minutes.

  • transaction_config (TransactionConfig, optional) – Global configuration for transactions. Defaults to None.

  • log_redaction (bool, optional) – Set to True to enable log redaction. Defaults to False (disabled).

  • compression (Compression, optional) – Set compression mode. Defaults to None.

  • compression_min_size (int, optional) – Set compression min size. Defaults to None.

  • compression_min_ratio (float, optional) – Set compression min size. Defaults to None.

  • lockmode (LockMode, optional) – DEPRECATED This option will be removed in a future version of the SDK. Set LockMode mode. Defaults to None.

  • tracer (CouchbaseTracer, optional) – Set an external tracer. Defaults to None, enabling the threshold_logging_tracer. Note when this is set, all tracing_options (see ClusterTracingOptions) and then enable_tracing option are ignored.

  • meter (CouchbaseMeter, optional) – Set an external meter. Defaults to None, enabling the logging_meter. Note when this is set, the logging_meter_emit_interval option is ignored.

  • dns_nameserver (str, optional) – VOLATILE This API is subject to change at any time. Set to configure custom DNS nameserver. Defaults to None.

  • dns_port (int, optional) – VOLATILE This API is subject to change at any time. Set to configure custom DNS port. Defaults to None.

  • dump_configuration (bool, optional) – Set to True to dump every new configuration when TRACE level logging. Defaults to False (disabled).

ClusterTimeoutOptions

class couchbase.options.ClusterTimeoutOptions(bootstrap_timeout=None, resolve_timeout=None, connect_timeout=None, kv_timeout=None, kv_durable_timeout=None, views_timeout=None, query_timeout=None, analytics_timeout=None, search_timeout=None, management_timeout=None, dns_srv_timeout=None, idle_http_connection_timeout=None, config_idle_redial_timeout=None, config_total_timeout=None)

Available timeout options to set when creating a cluster.

Warning

Importing options from couchbase.cluster is deprecated. All options should be imported from couchbase.options.

These will set the default timeouts for operations for the cluster. Some operations allow the timeout to be overridden on a per operation basis.

Parameters:
  • bootstrap_timeout (timedelta, optional) – Overall bootstrap timeout. Defaults to None.

  • resolve_timeout (timedelta, optional) – Time to resolve hostnames. Defaults to None.

  • connect_timeout (timedelta, optional) – connect timeout. Defaults to None.

  • kv_timeout (timedelta, optional) – KV operations timeout. Defaults to None.

  • kv_durable_timeout (timedelta, optional) – KV durability operations timeout. Defaults to None.

  • views_timeout (timedelta, optional) – views operations timeout. Defaults to None.

  • query_timeout (timedelta, optional) – query operations timeout. Defaults to None.

  • analytics_timeout (timedelta, optional) – analytics operations timeout. Defaults to None.

  • search_timeout (timedelta, optional) – search operations timeout. Defaults to None.

  • management_timeout (timedelta, optional) – management operations timeout. Defaults to None.

  • dns_srv_timeout (timedelta, optional) – Time to make DNS-SRV query. Defaults to None.

  • idle_http_connection_timeout (timedelta, optional) – Idle HTTP connection timeout. Defaults to None.

  • config_idle_redial_timeout (timedelta, optional) – Idle redial timeout. Defaults to None.

  • config_total_timeout (timedelta, optional) – DEPRECATED complete bootstrap timeout. Defaults to None.

ClusterTracingOptions

class couchbase.options.ClusterTracingOptions(tracing_threshold_kv=None, tracing_threshold_view=None, tracing_threshold_query=None, tracing_threshold_search=None, tracing_threshold_analytics=None, tracing_threshold_eventing=None, tracing_threshold_management=None, tracing_threshold_queue_size=None, tracing_threshold_queue_flush_interval=None, tracing_orphaned_queue_size=None, tracing_orphaned_queue_flush_interval=None)

Available tracing options to set when creating a cluster.

Warning

Importing options from couchbase.cluster is deprecated. All options should be imported from couchbase.options.

These will be the default timeouts for operations for the entire cluster

Parameters:
  • tracing_threshold_kv (timedelta, optional) – KV operations threshold. Defaults to None.

  • tracing_threshold_view (timedelta, optional) – Views operations threshold. Defaults to None.

  • tracing_threshold_query (timedelta, optional) – Query operations threshold. Defaults to None.

  • tracing_threshold_search (timedelta, optional) – Search operations threshold.. Defaults to None.

  • tracing_threshold_analytics (timedelta, optional) – Analytics operations threshold. Defaults to None.

  • tracing_threshold_eventing (timedelta, optional) – Eventing operations threshold. Defaults to None.

  • tracing_threshold_management (timedelta, optional) – Management operations threshold. Defaults to None.

  • tracing_threshold_queue_size (int, optional) – Size of tracing operations queue. Defaults to None.

  • tracing_threshold_queue_flush_interval (timedelta, optional) – Interveral to flush tracing operations queue. Defaults to None.

  • tracing_orphaned_queue_size (int, optional) – Size of tracing orphaned operations queue. Defaults to None.

  • tracing_orphaned_queue_flush_interval (timedelta, optional) – Interveral to flush tracing orphaned operations queue. Defaults to None.

Diagnostics

DiagnosticsOptions

class couchbase.options.DiagnosticsOptions(report_id=None)

Available options to for a diagnostics operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:

report_id (str, optional) – A unique identifier for the report generated by this operation.

PingOptions

class couchbase.options.PingOptions(timeout=None, report_id=None, service_types=None)

Available options to for a ping operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • report_id (str, optional) – A unique identifier for the report generated by this operation.

  • (Iterable[class (service_types) – ~couchbase.diagnostics.ServiceType]): The services which should be pinged.

WaitUntilReadyOptions

class couchbase.options.WaitUntilReadyOptions(desired_state=None, service_types=None)

Available options to for a wait until ready operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:
  • desired_state (ClusterState, optional) – The desired state to wait for in order to determine the cluster or bucket is ready. Defaults to Online.

  • (Iterable[class (service_types) – ~couchbase.diagnostics.ServiceType]): The services which should be pinged.

Key-Value

ExistsOptions

class couchbase.options.ExistsOptions(timeout=None)

Available options to for a key-value exists operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:

timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

GetOptions

class couchbase.options.GetOptions(timeout=None, with_expiry=None, project=None, transcoder=None)

Available options to for a key-value get operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • with_expiry (bool, optional) – Indicates that the expiry of the document should be fetched alongside the data itself. Defaults to False.

  • project (Iterable[str], optional) – Specifies a list of fields within the document which should be fetched. This allows for easy retrieval of select fields without incurring the overhead of fetching the whole document.

  • transcoder (Transcoder, optional) – Specifies an explicit transcoder to use for this specific operation. Defaults to JsonTranscoder.

GetAndLockOptions

class couchbase.options.GetAndLockOptions(timeout=None, transcoder=None)

Available options to for a key-value get and lock operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • transcoder (Transcoder, optional) – Specifies an explicit transcoder to use for this specific operation. Defaults to JsonTranscoder.

GetAndTouchOptions

class couchbase.options.GetAndTouchOptions(timeout=None, transcoder=None)

Available options to for a key-value get and touch operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • transcoder (Transcoder, optional) – Specifies an explicit transcoder to use for this specific operation. Defaults to JsonTranscoder.

InsertOptions

class couchbase.options.InsertOptions(timeout=None, expiry=None, durability=None, transcoder=None)

Available options to for a key-value insert operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • expiry (timedelta, optional) – Specifies the expiry time for this document.

  • durability (DurabilityType, optional) – Specifies the level of durability for this operation.

  • transcoder (Transcoder, optional) – Specifies an explicit transcoder to use for this specific operation. Defaults to JsonTranscoder.

RemoveOptions

class couchbase.options.RemoveOptions(timeout=None, cas=None, durability=None)

Available options to for a key-value remove operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:
  • cas (int, optional) – If specified, indicates that operation should be failed if the CAS has changed from this value, indicating that the document has changed.

  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • durability (DurabilityType, optional) – Specifies the level of durability for this operation.

ReplaceOptions

class couchbase.options.ReplaceOptions(timeout=None, expiry=None, cas=None, preserve_expiry=False, durability=None, transcoder=None)

Available options to for a key-value replace operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:
  • cas (int, optional) – If specified, indicates that operation should be failed if the CAS has changed from this value, indicating that the document has changed.

  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • expiry (timedelta, optional) – Specifies the expiry time for this document.

  • durability (DurabilityType, optional) – Specifies the level of durability for this operation.

  • preserve_expiry (bool, optional) – Specifies that any existing expiry on the document should be preserved.

  • transcoder (Transcoder, optional) – Specifies an explicit transcoder to use for this specific operation. Defaults to JsonTranscoder.

TouchOptions

class couchbase.options.TouchOptions(timeout=None)

Available options to for a key-value exists operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:

timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

UnlockOptions

class couchbase.options.UnlockOptions(timeout=None)

Available options to for a key-value exists operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:

timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

UpsertOptions

class couchbase.options.UpsertOptions(timeout=None, expiry=None, preserve_expiry=False, durability=None, transcoder=None)

Available options to for a key-value upsert operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • expiry (timedelta, optional) – Specifies the expiry time for this document.

  • durability (DurabilityType, optional) – Specifies the level of durability for this operation.

  • preserve_expiry (bool, optional) – Specifies that any existing expiry on the document should be preserved.

  • transcoder (Transcoder, optional) – Specifies an explicit transcoder to use for this specific operation. Defaults to JsonTranscoder.

ScanOptions

class couchbase.options.ScanOptions(timeout=None, ids_only=None, consistent_with=None, batch_byte_limit=None, batch_item_limit=None, batch_time_limit=None, transcoder=None, concurrency=None, span=None)

Available options to for a key-value scan operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global range scan operation timeout.

  • ids_only (bool, optional) – Specifies that scan should only return document ids. Defaults to False.

  • consistent_with (MutationState, optional) – Specifies a MutationState which the scan should be consistent with. Defaults to None.

  • batch_byte_limit (int, optional) – The limit applied to the number of bytes returned from the server for each partition batch. Defaults to 15k.

  • batch_item_limit (int, optional) – The limit applied to the number of items returned from the server for each partition batch. Defaults to 50.

  • transcoder (Transcoder, optional) – Specifies an explicit transcoder to use for this specific operation. Defaults to JsonTranscoder.

  • concurrency (int, optional) – The upper bound on the number of vbuckets that should be scanned in parallel. Defaults to 1.

Key-Value Multi

ExistsMultiOptions

class couchbase.options.ExistsMultiOptions(timeout=None, per_key_options=None, return_exceptions=None)

Available options to for a key-value multi-exists operation.

Options can be set at a global level (i.e. for all exists operations handled with this multi-exists operation). Use per_key_options to set specific ExistsOptions for specific keys.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • per_key_options (Dict[str, ExistsOptions], optional) – Specify ExistsOptions per key.

  • return_exceptions (bool, optional) – If False, raise an Exception when encountered. If True return the Exception without raising. Defaults to True.

GetMultiOptions

class couchbase.options.GetMultiOptions(timeout=None, with_expiry=None, project=None, transcoder=None, per_key_options=None, return_exceptions=None)

Available options to for a key-value multi-get operation.

Options can be set at a global level (i.e. for all get operations handled with this multi-get operation). Use per_key_options to set specific GetOptions for specific keys.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • with_expiry (bool, optional) – Indicates that the expiry of the document should be fetched alongside the data itself. Defaults to False.

  • project (Iterable[str], optional) – Specifies a list of fields within the document which should be fetched. This allows for easy retrieval of select fields without incurring the overhead of fetching the whole document.

  • transcoder (Transcoder, optional) – Specifies an explicit transcoder to use for this specific operation. Defaults to JsonTranscoder.

  • per_key_options (Dict[str, GetOptions], optional) – Specify GetOptions per key.

  • return_exceptions (bool, optional) – If False, raise an Exception when encountered. If True return the Exception without raising. Defaults to True.

InsertMultiOptions

class couchbase.options.InsertMultiOptions(timeout=None, expiry=None, durability=None, transcoder=None, per_key_options=None, return_exceptions=None)

Available options to for a key-value multi-insert operation.

Options can be set at a global level (i.e. for all insert operations handled with this multi-insert operation). Use per_key_options to set specific InsertOptions for specific keys.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • expiry (timedelta, optional) – Specifies the expiry time for this document.

  • durability (DurabilityType, optional) – Specifies the level of durability for this operation.

  • transcoder (Transcoder, optional) – Specifies an explicit transcoder to use for this specific operation. Defaults to JsonTranscoder.

  • per_key_options (Dict[str, InsertOptions], optional) – Specify InsertOptions per key.

  • return_exceptions (bool, optional) – If False, raise an Exception when encountered. If True return the Exception without raising. Defaults to True.

LockMultiOptions

couchbase.options.LockMultiOptions

alias of GetAndLockMultiOptions

ReplaceMultiOptions

class couchbase.options.ReplaceMultiOptions(timeout=None, expiry=None, cas=0, preserve_expiry=False, durability=None, transcoder=None, per_key_options=None, return_exceptions=None)

Available options to for a key-value multi-replace operation.

Options can be set at a global level (i.e. for all replace operations handled with this multi-replace operation). Use per_key_options to set specific ReplaceOptions for specific keys.

Parameters:
  • cas (int, optional) – If specified, indicates that operation should be failed if the CAS has changed from this value, indicating that the document has changed.

  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • expiry (timedelta, optional) – Specifies the expiry time for this document.

  • preserve_expiry (bool, optional) – Specifies that any existing expiry on the document should be preserved.

  • durability (DurabilityType, optional) – Specifies the level of durability for this operation.

  • transcoder (Transcoder, optional) – Specifies an explicit transcoder to use for this specific operation. Defaults to JsonTranscoder.

  • per_key_options (Dict[str, ReplaceOptions], optional) – Specify ReplaceOptions per key.

  • return_exceptions (bool, optional) – If False, raise an Exception when encountered. If True return the Exception without raising. Defaults to True.

RemoveMultiOptions

class couchbase.options.RemoveMultiOptions(timeout=None, cas=0, durability=None, transcoder=None, per_key_options=None, return_exceptions=None)

Available options to for a key-value multi-remove operation.

Options can be set at a global level (i.e. for all remove operations handled with this multi-remove operation). Use per_key_options to set specific RemoveOptions for specific keys.

Parameters:
  • cas (int, optional) – If specified, indicates that operation should be failed if the CAS has changed from this value, indicating that the document has changed.

  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • durability (DurabilityType, optional) – Specifies the level of durability for this operation.

  • transcoder (Transcoder, optional) – Specifies an explicit transcoder to use for this specific operation. Defaults to JsonTranscoder.

  • per_key_options (Dict[str, RemoveOptions], optional) – Specify RemoveOptions per key.

  • return_exceptions (bool, optional) – If False, raise an Exception when encountered. If True return the Exception without raising. Defaults to True.

TouchMultiOptions

class couchbase.options.TouchMultiOptions(timeout=None, per_key_options=None, return_exceptions=None)

Available options to for a key-value multi-touch operation.

Options can be set at a global level (i.e. for all touch operations handled with this multi-touch operation). Use per_key_options to set specific TouchOptions for specific keys.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • per_key_options (Dict[str, TouchOptions], optional) – Specify TouchOptions per key.

  • return_exceptions (bool, optional) – If False, raise an Exception when encountered. If True return the Exception without raising. Defaults to True.

UnlockMultiOptions

class couchbase.options.UnlockMultiOptions(timeout=None, per_key_options=None, return_exceptions=None)

Available options to for a key-value multi-unlock operation.

Options can be set at a global level (i.e. for all unlock operations handled with this multi-unlock operation). Use per_key_options to set specific UnlockOptions for specific keys.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • per_key_options (Dict[str, UnlockOptions], optional) – Specify UnlockOptions per key.

  • return_exceptions (bool, optional) – If False, raise an Exception when encountered. If True return the Exception without raising. Defaults to True.

UpsertMultiOptions

class couchbase.options.UpsertMultiOptions(timeout=None, expiry=None, preserve_expiry=False, durability=None, transcoder=None, per_key_options=None, return_exceptions=None)

Available options to for a key-value multi-upsert operation.

Options can be set at a global level (i.e. for all upsert operations handled with this multi-upsert operation). Use per_key_options to set specific UpsertOptions for specific keys.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global key-value operation timeout.

  • expiry (timedelta, optional) – Specifies the expiry time for this document.

  • durability (DurabilityType, optional) – Specifies the level of durability for this operation.

  • preserve_expiry (bool, optional) – Specifies that any existing expiry on the document should be preserved.

  • transcoder (Transcoder, optional) – Specifies an explicit transcoder to use for this specific operation. Defaults to JsonTranscoder.

  • per_key_options (Dict[str, UpsertOptions], optional) – Specify UpsertOptions per key.

  • return_exceptions (bool, optional) – If False, raise an Exception when encountered. If True return the Exception without raising. Defaults to True.

Query

QueryOptions

class couchbase.options.QueryOptions(timeout=None, read_only=None, scan_consistency=None, adhoc=None, client_context_id=None, max_parallelism=None, positional_parameters=None, named_parameters=None, pipeline_batch=None, pipeline_cap=None, profile=None, query_context=None, scan_cap=None, scan_wait=None, metrics=None, flex_index=None, preserve_expiry=None, use_replica=None, consistent_with=None, send_to_node=None, raw=None, span=None, serializer=None)

Available options to for a N1QL (SQL++) query.

Warning

Importing options from couchbase.cluster is deprecated. All options should be imported from couchbase.options.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global query operation timeout.

  • read_only (bool, optional) – Specifies that this query should be executed in read-only mode, disabling the ability for the query to make any changes to the data. Defaults to False.

  • scan_consistency (QueryScanConsistency, optional) – Specifies the consistency requirements when executing the query.

  • adhoc (bool, optional) – Specifies whether this is an ad-hoc query, or if it should be prepared for faster execution in the future. Defaults to True.

  • client_context_id (str, optional) – The returned client context id for this query. Defaults to None.

  • max_parallelism (int, optional) – This is an advanced option, see the query service reference for more information on the proper use and tuning of this option. Defaults to None.

  • positional_parameters (Iterable[JSONType], optional) – Positional values to be used for the placeholders within the query. Defaults to None.

  • named_parameters (Iterable[Dict[str, JSONType]], optional) – Named values to be used for the placeholders within the query. Defaults to None.

  • pipeline_batch (int, optional) – This is an advanced option, see the query service reference for more information on the proper use and tuning of this option. Defaults to None.

  • pipeline_cap (int, optional) – This is an advanced option, see the query service reference for more information on the proper use and tuning of this option. Defaults to None.

  • profile (QueryProfile, optional) – Specifies the level of profiling that should be used for the query. Defaults to Off.

  • query_context (str, optional) – Specifies the context within which this query should be executed. This can be scoped to a scope or a collection within the dataset. Defaults to None.

  • scan_cap (int, optional) – This is an advanced option, see the query service reference for more information on the proper use and tuning of this option. Defaults to None.

  • scan_wait (timedelta, optional) – This is an advanced option, see the query service reference for more information on the proper use and tuning of this option. Defaults to None.

  • metrics (bool, optional) – Specifies whether metrics should be captured as part of the execution of the query. Defaults to False.

  • flex_index (bool, optional) – Specifies whether flex-indexes should be enabled. Allowing the use of full-text search from the query service. Defaults to False.

  • preserve_expiry (bool, optional) – Specifies that any existing expiry on the document should be preserved. Defaults to False.

  • use_replica (bool, optional) – Specifies that the query engine should use replica nodes for KV fetches if the active node is down. Defaults to None.

  • consistent_with (MutationState, optional) – Specifies a MutationState which the query should be consistent with. Defaults to None.

  • serializer (Serializer, optional) – Specifies an explicit serializer to use for this specific N1QL operation. Defaults to DefaultJsonSerializer.

  • raw (Dict[str, Any], optional) – Specifies any additional parameters which should be passed to the query engine when executing the query. Defaults to None.

Subdocument

LookupInOptions

class couchbase.options.LookupInOptions(timeout=None, access_deleted=None)

Available options to for a subdocument lookup-in operation.

Warning

Importing options from couchbase.collection is deprecated. All options should be imported from couchbase.options.

Parameters:

timeout (timedelta, optional) – The timeout for this operation. Defaults to global subdocument operation timeout.

MutateInOptions

class couchbase.options.MutateInOptions(timeout=None, cas=0, durability=None, store_semantics=None, access_deleted=None, preserve_expiry=None)

Available options to for a subdocument mutate-in operation.

Warning

Importing options from couchbase.subdocument is deprecated. All options should be imported from couchbase.options.

Parameters:
  • cas (int, optional) – If specified, indicates that operation should be failed if the CAS has changed from this value, indicating that the document has changed.

  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global subdocument operation timeout.

  • durability (DurabilityType, optional) – Specifies the level of durability for this operation.

  • preserve_expiry (bool, optional) – Specifies that any existing expiry on the document should be preserved.

  • store_semantics (StoreSemantics, optional) – Specifies the store semantics to use for this operation.

Views

ViewOptions

class couchbase.options.ViewOptions(timeout=None, scan_consistency=None, skip=None, limit=None, startkey=None, endkey=None, startkey_docid=None, endkey_docid=None, inclusive_end=None, group=None, group_level=None, key=None, keys=None, order=None, reduce=None, on_error=None, debug=None, namespace=None, query_string=None, client_context_id=None, raw=None, full_set=None)

Available options to for a view query.

Warning

Importing options from couchbase.bucket is deprecated. All options should be imported from couchbase.options.

Parameters:
  • timeout (timedelta, optional) – The timeout for this operation. Defaults to global view query operation timeout.

  • scan_consistency (ViewScanConsistency, optional) – Specifies the consistency requirements when executing the view query. Defaults to None.

  • limit (int, optional) – Specifies the limit to the number of results that should be returned. Defaults to None.

  • skip (int, optional) – Specifies the number of results to skip from the index before returning results. Defaults to None.

  • startkey (JSONType, optional) – Specifies the first key that should be included in the results. Defaults to None.

  • endkey (JSONType, optional) – Specifies the last key that should be included in the results. Defaults to None.

  • startkey_docid (str, optional) – Specifies the first document ID that should be included in the results. Defaults to None.

  • endkey_docid (str, optional) – Specifies the last document ID that should be included in the results. Defaults to None.

  • inclusive_end (bool, optional) – Specifies whether the end key should be considered inclusive or exclusive. Defaults to None.

  • group (bool, optional) – Specifies whether the results should be grouped together. Defaults to None.

  • group_level (int, optional) – Specifies the level to which results should be group. Defaults to None.

  • key (JSONType, optional) – Specifies a specific key which should be fetched from the index. Defaults to None.

  • keys (List[JSONType], optional) – Specifies a list of keys which should be fetched from the index. Defaults to None.

  • order (ViewOrdering, optional) – Specifies the ordering that should be used when returning results. Defaults to None.

  • reduce (bool, optional) – Specifies whether reduction should be performed as part of the view query. Defaults to None.

  • on_error (ViewErrorMode, optional) – Specifies the error-handling behaviour that should be used when an error occurs. Defaults to None.

  • namespace (DesignDocumentNamespace, optional) – Specifies the namespace for the design document. Defaults to Development.

  • client_context_id (str, optional) – The returned client context id for this view query. Defaults to None.

  • raw (Dict[str, str], optional) – Specifies any additional parameters which should be passed to the view engine when executing the view query. Defaults to None.

  • full_set (bool, optional) – Specifies whether the query should force the entire set of document in the index to be included in the result. Defaults to None.