Views

Note

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

Enumerations

enum couchbase.views.ViewScanConsistency(value)

An enumeration.

Valid values are as follows:

NOT_BOUNDED = <ViewScanConsistency.NOT_BOUNDED: 'ok'>
REQUEST_PLUS = <ViewScanConsistency.REQUEST_PLUS: 'false'>
UPDATE_AFTER = <ViewScanConsistency.UPDATE_AFTER: 'update_after'>

Options

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.

Results

ViewMetaData

class couchbase.views.ViewMetaData(raw)

ViewResult

class couchbase.result.ViewResult
rows()

The rows which have been returned by the view 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 view query.

Returns:

An instance of ViewMetaData.

Return type:

ViewMetaData