langchain_community.storage.astradb
.AstraDBBaseStore¶
- class langchain_community.storage.astradb.AstraDBBaseStore(*args: Any, **kwargs: Any)[source]¶
Base class for the DataStax AstraDB data store.
Methods
__init__
(*args, **kwargs)amdelete
(keys)Delete the given keys and their associated values.
amget
(keys)Get the values associated with the given keys.
amset
(key_value_pairs)Set the values for the given keys.
ayield_keys
(*[, prefix])Get an iterator over keys that match the given prefix.
decode_value
(value)Decodes value from Astra DB
encode_value
(value)Encodes value for Astra DB
mdelete
(keys)Delete the given keys and their associated values.
mget
(keys)Get the values associated with the given keys.
mset
(key_value_pairs)Set the values for the given keys.
yield_keys
(*[, prefix])Get an iterator over keys that match the given prefix.
- Parameters
args (Any) –
kwargs (Any) –
- __init__(*args: Any, **kwargs: Any) None [source]¶
- Parameters
args (Any) –
kwargs (Any) –
- Return type
None
- async amdelete(keys: Sequence[str]) None [source]¶
Delete the given keys and their associated values.
- Parameters
keys (Sequence[K]) – A sequence of keys to delete.
- Return type
None
- async amget(keys: Sequence[str]) List[Optional[V]] [source]¶
Get the values associated with the given keys.
- Parameters
keys (Sequence[K]) – A sequence of keys.
- Returns
A sequence of optional values associated with the keys. If a key is not found, the corresponding value will be None.
- Return type
List[Optional[V]]
- async amset(key_value_pairs: Sequence[Tuple[str, V]]) None [source]¶
Set the values for the given keys.
- Parameters
key_value_pairs (Sequence[Tuple[K, V]]) – A sequence of key-value pairs.
- Return type
None
- async ayield_keys(*, prefix: Optional[str] = None) AsyncIterator[str] [source]¶
Get an iterator over keys that match the given prefix.
- Parameters
prefix (str) – The prefix to match.
- Returns
An iterator over keys that match the given prefix.
This method is allowed to return an iterator over either K or str depending on what makes more sense for the given store.
- Return type
Iterator[K | str]
- abstract decode_value(value: Any) Optional[V] [source]¶
Decodes value from Astra DB
- Parameters
value (Any) –
- Return type
Optional[V]
- abstract encode_value(value: Optional[V]) Any [source]¶
Encodes value for Astra DB
- Parameters
value (Optional[V]) –
- Return type
Any
- mdelete(keys: Sequence[str]) None [source]¶
Delete the given keys and their associated values.
- Parameters
keys (Sequence[K]) – A sequence of keys to delete.
- Return type
None
- mget(keys: Sequence[str]) List[Optional[V]] [source]¶
Get the values associated with the given keys.
- Parameters
keys (Sequence[K]) – A sequence of keys.
- Returns
A sequence of optional values associated with the keys. If a key is not found, the corresponding value will be None.
- Return type
List[Optional[V]]
- mset(key_value_pairs: Sequence[Tuple[str, V]]) None [source]¶
Set the values for the given keys.
- Parameters
key_value_pairs (Sequence[Tuple[K, V]]) – A sequence of key-value pairs.
- Return type
None
- yield_keys(*, prefix: Optional[str] = None) Iterator[str] [source]¶
Get an iterator over keys that match the given prefix.
- Parameters
prefix (str) – The prefix to match.
- Returns
An iterator over keys that match the given prefix.
This method is allowed to return an iterator over either K or str depending on what makes more sense for the given store.
- Return type
Iterator[K | str]