Analytics

Note

Further updates to the analytics docs will come with future 4.0.x releases.

Enumerations

enum couchbase.analytics.AnalyticsScanConsistency(value)

For use with consistency, will allow cached values to be returned. This will improve performance but may not reflect the latest data in the server.

Valid values are as follows:

NOT_BOUNDED = <AnalyticsScanConsistency.NOT_BOUNDED: 'not_bounded'>
REQUEST_PLUS = <AnalyticsScanConsistency.REQUEST_PLUS: 'request_plus'>

Options

class couchbase.options.AnalyticsOptions(timeout=None, read_only=None, scan_consistency=None, positional_parameters=None, named_parameters=None, client_context_id=None, priority=None, metrics=None, query_context=None, raw=None, serializer=None)

Available options to for an analytics query.

Warning

Importing options from couchbase.analytics 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 analytics 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 (AnalyticsScanConsistency, optional) – Specifies the consistency requirements when executing the analytics query.

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

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

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

  • priority (bool, optional) – Indicates whether this analytics query should be executed with a specific priority level. Defaults to False.

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

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

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

Results

AnalyticsMetaData

class couchbase.analytics.AnalyticsMetaData(raw)

AnalyticsMetrics

class couchbase.analytics.AnalyticsMetrics(raw)

AnalyticsResult

class couchbase.result.AnalyticsResult
rows()

The rows which have been returned by the analytics query.

Note

If using the acouchbase API be sure to use async for when looping over rows.

Returns:

Either an iterable or async iterable.

Return type:

Iterable

metadata()

The meta-data which has been returned by the analytics query.

Returns:

An instance of AnalyticsMetaData.

Return type:

AnalyticsMetaData