Bucket
- class txcouchbase.bucket.Bucket(cluster: Cluster, bucket_name: str)
A bucket in a cluster: its scopes and collections, and the operations run against it.
Get one from
bucket().- Parameters:
- close() Deferred
Shuts down this bucket instance. Cleaning up all resources associated with it.
Warning
Use of this method is almost always unnecessary. Bucket resources should be cleaned up once the bucket instance falls out of scope. However, in some applications tuning resources is necessary and in those types of applications, this method might be beneficial.
- collection(collection_name: str) Collection
Creates a
Collectioninstance of the specified collection.- Parameters:
collection_name (str) – Name of the collection to reference.
- Returns:
A
Collectioninstance of the specified collection.- Return type:
- collections() CollectionManager
Get a manager for the scopes and collections of this bucket.
- Returns:
A
CollectionManagerinstance.- Return type:
- default_collection() Collection
Creates a
Collectioninstance of the default collection.- Returns:
A
Collectioninstance of the default collection.- Return type:
- on_connect() Deferred[None]
Wait until the bucket is open.
- Returns:
Fires once the bucket is open, or fails if it cannot be opened.
- Return type:
- ping(opts: PingOptions | None = None, **kwargs: Unpack[PingOptionsKwargs]) Deferred[PingResult]
Performs a ping operation against the bucket.
The ping operation pings the services which are specified (or all services if none are specified). Returns a report which describes the outcome of the ping operations which were performed.
- Parameters:
opts (
PingOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used in place or to override provided
PingOptions
- Returns:
A report which describes the outcome of the ping operations which were performed.
- Return type:
Deferred[
PingResult]
- view_indexes() ViewIndexManager
Get a manager for the view design documents and views of this bucket.
Deprecated since version 4.6.0: Views are deprecated in Couchbase Server 7.0+, and will be removed from a future server version. Views are not compatible with the Magma storage engine. Instead of views, use indexes and queries using the Index Service (GSI) and the Query Service (SQL++).
- Returns:
A
ViewIndexManagerinstance.- Return type:
- view_query(design_doc: str, view_name: str, view_options: ViewOptions | None = None, **kwargs: Unpack[ViewOptionsKwargs]) Deferred[ViewResult]
Executes a View query against the bucket.
Deprecated since version 4.6.0: Views are deprecated in Couchbase Server 7.0+, and will be removed from a future server version. Views are not compatible with the Magma storage engine. Instead of views, use indexes and queries using the Index Service (GSI) and the Query Service (SQL++).
Note
The query is sent when this is called, and the Deferred fires once the core has buffered the response, so iterating the
ViewResultdoes not block the reactor.See also
ViewIndexManager: for how to manage design documents
- Parameters:
design_doc (str) – The name of the design document containing the view to execute.
view_name (str) – The name of the view to execute.
view_options (
ViewOptions) – Optional parameters for the view query operation.**kwargs – keyword arguments that can be used in place or to override provided
ViewOptions
- Returns:
An instance of a
ViewResultwhich provides access to iterate over the query results and access metadata about the query.- Return type:
Deferred[
ViewResult]