MCPcopy Create free account
hub / github.com/couchbase/couchbase-python-client / get

Method get

acouchbase/datastructures.py:469–495  ·  view source on GitHub ↗

Retrieve a value from a map. :param key: The document ID :param mapkey: Key within the map to retrieve :return: :class:`~.ValueResult` .. seealso:: :meth:`map_add` for an example

(self, mapkey: str)

Source from the content-addressed store, hash-verified

467 create_type=True)
468
469 async def get(self, mapkey: str) -> Any:
470 """
471 Retrieve a value from a map.
472
473 :param key: The document ID
474 :param mapkey: Key within the map to retrieve
475 :return: :class:`~.ValueResult`
476
477 .. seealso:: :meth:`map_add` for an example
478 """
479 op_type = DatastructureOperationType.MapGet
480 async with ObservableRequestHandler(op_type, self._impl.observability_instruments) as ds_obs_handler:
481 ds_obs_handler.create_kv_span(self._impl._request_builder._collection_dtls.get_details_as_dict())
482 kv_op_type = KeyValueOperationType.LookupIn
483 async with ObservableRequestHandler(kv_op_type, self._impl.observability_instruments) as obs_handler:
484 op = subdoc_get(mapkey)
485 req, transcoder = self._impl.request_builder.build_lookup_in_request(self._key,
486 (op,),
487 obs_handler,
488 parent_span=ds_obs_handler.wrapped_span) # noqa: E501
489 sd_res = await self._execute_op(self._impl.lookup_in,
490 req,
491 obs_handler,
492 ds_obs_handler.wrapped_span,
493 create_type=True,
494 transcoder=transcoder)
495 return sd_res.value[0].get('value', None)
496
497 async def remove(self, mapkey: str) -> None:
498 """

Callers 6

get_atMethod · 0.45
sizeMethod · 0.45
sizeMethod · 0.45
sizeMethod · 0.45
popMethod · 0.45
sizeMethod · 0.45

Calls 5

_execute_opMethod · 0.95
get_details_as_dictMethod · 0.80
create_kv_spanMethod · 0.45

Tested by

no test coverage detected