kv
put
Store or replace a KV value by key.
strata kv putdb.kv.put(key: 'str | bytes', value: 'str | bytes') -> 'Any'wire kv_put
Writes a binary value to the selected KV space. If the key already exists, Strata replaces the visible value and records a new version.
Successful mutations return an acknowledgement of the outcome: for a state-changing write, the affected target with the mutation effect and commit facts; for mutations that produce a domain result (such as a branch or a promotion outcome), that result object.
To see the complete help for this command, run:
strata kv put --helphelp(db.kv.put)
Example
Store a value, then replace it.
strata kv put setting v1strata kv put setting v2 # replaces the visible valuestrata kv get setting
_ = db.kv.put("setting", "v1")_ = db.kv.put("setting", "v2") # replaces the visible valuedb.kv.get("setting")
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| key | Bytes | yes | Key bytes. |
| value | Bytes | yes | Value bytes. |
| 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
MutationAck<KvWrite>
- dataobject
- 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 |