Result Objects¶
- class couchbase.result.AsyncGetReplicaResult(sdk2_result)[source]¶
Bases:
couchbase.result.AsyncWrapper.gen_wrapper.<locals>.Wrapped
GetReplicaResult is the return type for full read operations.
- Warning
This is an internal API call.
Components external to Couchbase Python Client should not rely on it is not intended for use outside the module, even to other Couchbase components.
- class couchbase.result.AsyncGetResult(core_result)[source]¶
Bases:
couchbase.result.AsyncWrapper.gen_wrapper.<locals>.Wrapped
GetResult is the return type for full read operations.
- Warning
This is an internal API call.
Components external to Couchbase Python Client should not rely on it is not intended for use outside the module, even to other Couchbase components.
- class couchbase.result.AsyncMultiGetResult() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)[source]¶
Bases:
couchbase.result.AsyncWrapper.gen_wrapper.<locals>.Wrapped
- class couchbase.result.AsyncMultiMutationResult() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)[source]¶
Bases:
couchbase.result.AsyncWrapper.gen_wrapper.<locals>.Wrapped
- class couchbase.result.AsyncMutationResult(core_result)[source]¶
Bases:
couchbase.result.AsyncWrapper.gen_wrapper.<locals>.Wrapped
This is the base implementation for SDK3 results
- param int cas
CAS value
- param Optional[int] error
error code if applicable
- Warning
This is an internal API call.
Components external to Couchbase Python Client should not rely on it is not intended for use outside the module, even to other Couchbase components.
- class couchbase.result.ContentProxySubdoc(content)[source]¶
Bases:
object
Used to provide access to Result content via Result.content_as[type]
- Warning
This is an internal API call.
Components external to Couchbase Python Client should not rely on it is not intended for use outside the module, even to other Couchbase components.
- class couchbase.result.ExistsResult(original)[source]¶
Bases:
couchbase.result.Result
- Warning
This is an internal API call.
Components external to Couchbase Python Client should not rely on it is not intended for use outside the module, even to other Couchbase components.
- class couchbase.result.GetReplicaResult(original)[source]¶
Bases:
couchbase.result.GetResult
GetReplicaResult is the return type for full read operations.
- Warning
This is an internal API call.
Components external to Couchbase Python Client should not rely on it is not intended for use outside the module, even to other Couchbase components.
- class couchbase.result.GetResult(original)[source]¶
Bases:
couchbase.result.Result
GetResult is the return type for full read operations.
- Warning
This is an internal API call.
Components external to Couchbase Python Client should not rely on it is not intended for use outside the module, even to other Couchbase components.
- property expiry¶
- Warning
This is a deprecated API, use expiryTime instead.
- Return type
datetime
- class couchbase.result.LookupInResult(original, **kwargs)[source]¶
Bases:
couchbase.result.Result
LookupInResult is the return type for lookup_in operations.
- Warning
This is an internal API call.
Components external to Couchbase Python Client should not rely on it is not intended for use outside the module, even to other Couchbase components.
- property content_as¶
Return a proxy that allows extracting the content as a provided type.
Get first value as a string:
value = cb.get('key').content_as[str](0)
- Return type
- Returns
returns as ContentProxySubdoc
- class couchbase.result.MultiGetResult() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)[source]¶
Bases:
couchbase.result.MultiResultBase
- class couchbase.result.MultiMutationResult() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)[source]¶
Bases:
couchbase.result.MultiResultBase
- class couchbase.result.MultiResult¶
Bases:
dict
dict
subclass to holdResult
objectsThis object also contains some of the heavy lifting, but this is not currently exposed in python-space . An additional method is
all_ok()
, which allows to see if all commands completed successfully- all_ok¶
Whether all the items in this result are successful
- class couchbase.result.MutateInResult(content, **options)[source]¶
Bases:
couchbase.result.MutationResult
MutateInResult is the return type for mutate_in operations.
- Warning
This is an internal API call.
Components external to Couchbase Python Client should not rely on it is not intended for use outside the module, even to other Couchbase components.
- property content_as¶
Return a proxy that allows extracting the content as a provided type.
Get first result as a string:
cb.mutate_in('user', SD.array_addunique('tags', 'dog'), SD.counter('updates', 1)).content_as[str](0)
- Return type
- Returns
returns a
ContentProxySubdoc
- property key¶
Original key of the operation
- Return type
str
- class couchbase.result.MutationResult(original)[source]¶
Bases:
couchbase.result.Result
This is the base implementation for SDK3 results
- param int cas
CAS value
- param Optional[int] error
error code if applicable
- Warning
This is an internal API call.
Components external to Couchbase Python Client should not rely on it is not intended for use outside the module, even to other Couchbase components.
- class couchbase.result.PingResult(original, is_async=None)[source]¶
Bases:
object
- Warning
This is an internal API call.
Components external to Couchbase Python Client should not rely on it is not intended for use outside the module, even to other Couchbase components.
- class couchbase.result.PingResult(original, is_async=None)[source]¶
Bases:
object
- Warning
This is an internal API call.
Components external to Couchbase Python Client should not rely on it is not intended for use outside the module, even to other Couchbase components.
- class couchbase.result.Result(original)[source]¶
Bases:
object
This is the base implementation for SDK3 results
- param int cas
CAS value
- param Optional[int] error
error code if applicable
- Warning
This is an internal API call.
Components external to Couchbase Python Client should not rely on it is not intended for use outside the module, even to other Couchbase components.
- property cas¶
The CAS value
- Return type
int
- Returns
the CAS value
- class couchbase.result.ViewResult(*args, row_factory=<class 'couchbase.result.ViewRow'>, **kwargs)[source]¶
Bases:
couchbase_core.iterable_wrapper.<locals>.IterableWrapperSpecific
Construct a iterable which can be used to iterate over view query results.
- Parameters
parent (
Client
) – The parent Client objectdesign (string) – The design document
view (string) – The name of the view within the design document
row_processor (callable) – See
row_processor
for more details.include_docs (boolean) –
If set, the document itself will be retrieved for each row in the result. The default algorithm uses
get_multi()
for each page (i.e. everystreaming
results).The
reduce
family of attributes must not be active, as results froreduce
views do not have corresponding doc IDs (as these are aggregation functions).query – If set, should be a
Query
orSpatialQuery
object. It is illegal to use this in conjunction with additionalparams
params – Extra view options. This may be used to pass view arguments (as defined in
Query
) without explicitly constructing aQuery
object. It is illegal to use this together with thequery
argument. If you wish to ‘inline’ additional arguments to the providedquery
object, use the query’supdate()
method instead.
This object is an iterator - it does not send out the request until the first item from the iterator is request. See
__iter__()
for more details on what this object returns.Simple view query, with no extra options:
# c is the Client object. for result in View(c, "beer", "brewery_beers"): print("emitted key: {0}, doc_id: {1}" .format(result.key, result.docid))
Execute a view with extra query options:
# Implicitly creates a Query object view = View(c, "beer", "by_location", limit=4, reduce=True, group_level=2)
Execute a spatial view:
from couchbase_core.views.params import SpatialQuery # .... q = SpatialQuery() q.start_range = [ -119.9556, 38.7056 ] q.end_range = [ -118.8122, 39.7086 ] view = View(c, 'geodesign', 'spatialview', query=q) for row in view: print('Location is {0}'.format(row.geometry))
Pass a Query object:
q = Query( stale=False, inclusive_end=True, mapkey_range=[ ["21st_ammendment_brewery_cafe"], ["21st_ammendment_brewery_cafe", Query.STRING_RANGE_END] ] ) view = View(c, "beer", "brewery_beer", query=q)
Add extra parameters to query object for single call:
view = View(c, "beer", "brewery_beer", query=q.update(debug=True, copy=True))
Include documents with query:
view = View(c, "beer", "brewery_beer", query=q, include_docs=True) for result in view: print("Emitted key: {0}, Document: {1}".format( result.key, result.doc.value))