kv
batch_get
Read multiple KV values by key.
db.kv.get_many(keys: 'Sequence[str | bytes]') -> 'list[Optional[bytes]]'wire kv_batch_get
Reads several KV keys and returns positional item results. Each item records whether the corresponding key was found and includes value metadata when present.
Itemwise batches return one positional item result per input item. The outer batch status summarizes whether all, some, or none of the items succeeded.
To see the complete help for this command, run:
help(db.kv.get_many)
Example
Read many keys at once; a missing key comes back as null.
_ = db.kv.put_many([{"key": "a", "value": "1"}, {"key": "b", "value": "2"}])db.kv.get_many(["a", "b", "missing"])
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| keys | array | yes | Keys to read. |
| branch | string or null | no | Target branch. Defaults to the executor handle branch. |
| space | string or null | no | Target product space. Defaults to `"default"`. |
Returns
BatchResult<Maybe<Bytes>>
- dataBatchResult2
- typestring
Errors
Recover by code. Retry policy and commit outcome come from the shipped error registry.
| Code | Retry | Commit outcome |
|---|---|---|
| failed_precondition.engine.runtime_closed | never | not_started |
| not_found.engine.branch | never | not_applicable |
| invalid_argument.engine.product_space | never | not_started |
| invalid_argument.engine.kv_key | never | not_started |
| invalid_argument.engine.kv_batch | never | not_started |