Options

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 subdocument 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 subdocument 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.

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 subdocument 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.

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 subdocument operation timeout.

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

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)

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 to False to disable compression. Defaults to True (enabled).

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

  • 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 (LockMode, 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.

  • compression – 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.

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) – bootstrap timeout. Defaults to None.

  • resolve_timeout (timedelta, optional) – resolve timeout. 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) – DNS SRV connection timeout. 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 (int, 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 (int, 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 (int, 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.

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. Default 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. Default 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 (int, 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. Default to True.

LockMultiOptions

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

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

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

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

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

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

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 (int, 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. Default 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. Default 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. Default 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. Default 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 (int, 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. Default 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, 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. Default 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.

  • 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.