Analytics

class couchbase.management.analytics.AnalyticsDataType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

The type of a field an analytics index covers.

DOUBLE = 'double'
INT64 = 'int64'
STRING = 'string'
class couchbase.management.analytics.AnalyticsDataset(dataset_name: str | None = None, dataverse_name: str | None = None, link_name: str | None = None, bucket_name: str | None = None)

An analytics dataset, as the analytics service describes it.

dataset_name

The name of the dataset.

Type:

str | None

dataverse_name

The name of the dataverse the dataset is in.

Type:

str | None

The name of the link the dataset reads from.

Type:

str | None

bucket_name

The name of the bucket the dataset reads from.

Type:

str | None

class couchbase.management.analytics.AnalyticsEncryptionLevel(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

How a remote Couchbase analytics link encrypts its connection.

NONE sends everything in plain text, HALF encrypts only the credentials, and FULL encrypts the whole connection with TLS.

FULL = 'full'
HALF = 'half'
NONE = 'none'
class couchbase.management.analytics.AnalyticsIndex(name: str | None = None, dataset_name: str | None = None, dataverse_name: str | None = None, is_primary: bool | None = None)

An analytics index, as the analytics service describes it.

name

The name of the index.

Type:

str | None

dataset_name

The name of the dataset the index is on.

Type:

str | None

dataverse_name

The name of the dataverse the dataset is in.

Type:

str | None

is_primary

Whether the index is the dataset’s primary index.

Type:

bool | None

class couchbase.management.analytics.AnalyticsIndexManager(impl: AnalyticsMgmtInterface)

Performs management operations on analytics dataverses, datasets, indexes and links.

Connects a link, so that its datasets start receiving data.

Parameters:
  • options (ConnectLinkOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

create_dataset(dataset_name: str, bucket_name: str, options: CreateDatasetOptions | None = None, **kwargs: Unpack[CreateDatasetOptionsKwargs]) → None

Creates a new analytics dataset over a bucket.

Parameters:
  • dataset_name (str) – The name of the dataset to create.

  • bucket_name (str) – The name of the bucket the dataset reads from.

  • options (CreateDatasetOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:
create_dataverse(dataverse_name: str, options: CreateDataverseOptions | None = None, **kwargs: Unpack[CreateDataverseOptionsKwargs]) → None

Creates a new analytics dataverse.

Parameters:
  • dataverse_name (str) – The name of the dataverse to create.

  • options (CreateDataverseOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:
create_index(index_name: str, dataset_name: str, fields: dict[str, AnalyticsDataType], options: CreateAnalyticsIndexOptions | None = None, **kwargs: Unpack[CreateAnalyticsIndexOptionsKwargs]) → None

Creates a new analytics index on a dataset.

Parameters:
  • index_name (str) – The name of the index to create.

  • dataset_name (str) – The name of the dataset to index.

  • fields (dict[str, AnalyticsDataType]) – The fields the index covers, each mapped to its type.

  • options (CreateAnalyticsIndexOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:

InvalidArgumentException – If the index_name or dataset_name is not a str, or fields is not a dict of AnalyticsDataType values.

Creates a new analytics link.

Parameters:
Raises:

Disconnects a link, so that its datasets stop receiving data.

Parameters:
  • options (DisconnectLinkOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

drop_dataset(dataset_name: str, options: DropDatasetOptions | None = None, **kwargs: Unpack[DropDatasetOptionsKwargs]) → None

Drops an existing analytics dataset.

Parameters:
  • dataset_name (str) – The name of the dataset to drop.

  • options (DropDatasetOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:
drop_dataverse(dataverse_name: str, options: DropDataverseOptions | None = None, **kwargs: Unpack[DropDataverseOptionsKwargs]) → None

Drops an existing analytics dataverse.

Parameters:
  • dataverse_name (str) – The name of the dataverse to drop.

  • options (DropDataverseOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:
drop_index(index_name: str, dataset_name: str, options: DropAnalyticsIndexOptions | None = None, **kwargs: Unpack[DropAnalyticsIndexOptionsKwargs]) → None

Drops an existing analytics index.

Parameters:
  • index_name (str) – The name of the index to drop.

  • dataset_name (str) – The name of the dataset the index is on.

  • options (DropAnalyticsIndexOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:

InvalidArgumentException – If the index_name or dataset_name is not a str.

Drops an existing analytics link.

Parameters:
  • link_name (str) – The name of the link to drop.

  • dataverse_name (str) – The name of the dataverse the link is in.

  • options (DropLinkAnalyticsOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:
get_all_datasets(options: GetAllDatasetOptions | None = None, **kwargs: Unpack[GetAllDatasetOptionsKwargs]) → Iterable[AnalyticsDataset]

Returns every analytics dataset.

Parameters:
  • options (GetAllDatasetOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Returns:

The datasets.

Return type:

Iterable[AnalyticsDataset]

get_all_indexes(options: GetAllAnalyticsIndexesOptions | None = None, **kwargs: Unpack[GetAllAnalyticsIndexesOptionsKwargs]) → Iterable[AnalyticsIndex]

Returns every analytics index.

Parameters:
  • options (GetAllAnalyticsIndexesOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Returns:

The indexes.

Return type:

Iterable[AnalyticsIndex]

Returns the analytics links, all of them unless the options narrow the search.

Parameters:
  • options (GetLinksAnalyticsOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Returns:

The links.

Return type:

Iterable[AnalyticsLink]

Raises:

DataverseNotFoundException – If the dataverse named in the options does not exist.

get_pending_mutations(options: GetPendingMutationsOptions | None = None, **kwargs: Unpack[GetPendingMutationsOptionsKwargs]) → dict[str, int]

Returns how many mutations each dataset has yet to process.

Parameters:
  • options (GetPendingMutationsOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Returns:

The number of pending mutations, keyed by dataverse and dataset name.

Return type:

dict[str, int]

Replaces an existing analytics link.

Parameters:
Raises:

A link from the analytics service to a source of data outside the local cluster.

A link is one of CouchbaseRemoteAnalyticsLink, S3ExternalAnalyticsLink or AzureBlobExternalAnalyticsLink. Links are available on Couchbase Server 7.0 and later.

abstract dataverse_name() → str

Get the name of the dataverse the link is in.

Returns:

The name of the dataverse the link is in.

Return type:

str

Get the kind of data source the link connects to.

Returns:

The kind of data source the link connects to.

Return type:

AnalyticsLinkType

abstract name() → str

Get the name of the link.

Returns:

The name of the link.

Return type:

str

abstract validate() → None

Check that the link has every setting its kind requires.

Raises:

InvalidArgumentException – If a required setting is missing.

class couchbase.management.analytics.AnalyticsLinkType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

The kind of data source an analytics link connects to.

AzureBlobExternal = 'azureblob'
CouchbaseRemote = 'couchbase'
S3External = 's3'

A link to data in Azure Blob Storage.

The link authenticates with a connection string, or with an account name and either an account key or a shared access signature.

Parameters:
  • dataverse (str) – The name of the dataverse the link is in.

  • link_name (str) – The name of the link.

  • connection_string (str, optional) – The Azure connection string.

  • account_name (str, optional) – The storage account name.

  • account_key (str, optional) – The storage account key.

  • shared_access_signature (str, optional) – A shared access signature for the account.

  • blob_endpoint (str, optional) – The blob service endpoint.

  • endpoint_suffix (str, optional) – The endpoint suffix.

dataverse_name() → str

Get the name of the dataverse the link is in.

Returns:

The name of the dataverse the link is in.

Return type:

str

Get the kind of data source the link connects to.

Returns:

The kind of data source the link connects to.

Return type:

AnalyticsLinkType

name() → str

Get the name of the link.

Returns:

The name of the link.

Return type:

str

validate() → None

Check that the link has every setting its kind requires.

Raises:

InvalidArgumentException – If a required setting is missing.

class couchbase.management.analytics.CouchbaseAnalyticsEncryptionSettings(encryption_level: AnalyticsEncryptionLevel | None = None, certificate: bytes | bytearray | None = None, client_certificate: bytes | bytearray | None = None, client_key: bytes | bytearray | None = None)

The encryption a remote Couchbase analytics link uses.

Parameters:
  • encryption_level (AnalyticsEncryptionLevel, optional) – How the link encrypts its connection. Defaults to NONE.

  • certificate (bytes | bytearray, optional) – The remote cluster’s certificate, required for FULL.

  • client_certificate (bytes | bytearray, optional) – The client certificate, required for FULL.

  • client_key (bytes | bytearray, optional) – The client certificate’s key, required for FULL.

property certificate: bytes | bytearray | None

The remote cluster’s certificate.

property client_certificate: bytes | bytearray | None

The client certificate.

property client_key: bytes | bytearray | None

The client certificate’s key.

property encryption_level: AnalyticsEncryptionLevel

How the link encrypts its connection.

A link to a bucket on another Couchbase cluster.

Parameters:
  • dataverse (str) – The name of the dataverse the link is in.

  • link_name (str) – The name of the link.

  • hostname (str) – The hostname of the remote cluster.

  • encryption (CouchbaseAnalyticsEncryptionSettings) – How the link encrypts its connection.

  • username (str, optional) – The username to authenticate with, required unless the encryption level is FULL.

  • password (str, optional) – The password to authenticate with, required unless the encryption level is FULL.

dataverse_name() → str

Get the name of the dataverse the link is in.

Returns:

The name of the dataverse the link is in.

Return type:

str

Get the kind of data source the link connects to.

Returns:

The kind of data source the link connects to.

Return type:

AnalyticsLinkType

name() → str

Get the name of the link.

Returns:

The name of the link.

Return type:

str

validate() → None

Check that the link has every setting its kind requires.

Raises:

InvalidArgumentException – If a required setting is missing.

A link to data in Amazon S3.

Parameters:
  • dataverse (str) – The name of the dataverse the link is in.

  • link_name (str) – The name of the link.

  • access_key_id (str) – The AWS access key ID.

  • region (str) – The AWS region the data is in.

  • secret_access_key (str, optional) – The AWS secret access key. The link is not valid without it.

  • session_token (str, optional) – The AWS session token, for temporary credentials.

  • service_endpoint (str, optional) – The S3 endpoint, in place of the region’s default.

dataverse_name() → str

Get the name of the dataverse the link is in.

Returns:

The name of the dataverse the link is in.

Return type:

str

Get the kind of data source the link connects to.

Returns:

The kind of data source the link connects to.

Return type:

AnalyticsLinkType

name() → str

Get the name of the link.

Returns:

The name of the link.

Return type:

str

validate() → None

Check that the link has every setting its kind requires.

Raises:

InvalidArgumentException – If a required setting is missing.