Key-value commands
13 commands. Each entry gives the invocation and an example, in the interface you pick; open the details for parameters, return shape and error codes.
batch_delete
Delete multiple KV keys in one itemwise batch.
db.kv.delete_many(keys: 'Sequence[str | bytes]') -> 'BatchResult'
Deletes multiple KV keys and returns one positional mutation result per key. Missing keys are represented as no-op item results.
To see the complete help for this command, run:
help(db.kv.delete_many)
Example
_ = db.kv.put_many([{"key": "a", "value": "1"}, {"key": "b", "value": "2"}])_ = db.kv.delete_many(["a", "b"])db.kv.exists_many(["a", "b"])
batch_exists
Check existence for multiple KV keys.
db.kv.exists_many(keys: 'Sequence[str | bytes]') -> 'list[bool]'
Checks several KV keys and returns positional boolean status values. The response preserves the input order.
To see the complete help for this command, run:
help(db.kv.exists_many)
Example
_ = db.kv.put_many([{"key": "a", "value": "1"}])db.kv.exists_many(["a", "missing"])
batch_get
Read multiple KV values by key.
db.kv.get_many(keys: 'Sequence[str | bytes]') -> 'list[Optional[bytes]]'
Reads several KV keys and returns positional item results. Each item records whether the corresponding key was found and includes value metadata when present.
To see the complete help for this command, run:
help(db.kv.get_many)
Example
_ = db.kv.put_many([{"key": "a", "value": "1"}, {"key": "b", "value": "2"}])db.kv.get_many(["a", "b", "missing"])
batch_put
Store multiple KV values in one itemwise batch.
db.kv.put_many(entries: 'Any') -> 'BatchResult'
Writes multiple KV entries using the executor batch contract. Valid items share commit facts where the underlying engine applies them together.
To see the complete help for this command, run:
help(db.kv.put_many)
Example
_ = db.kv.put_many([{"key": "a", "value": "1"}, {"key": "b", "value": "2"}])db.kv.get_many(["a", "b"])
count
Count visible KV keys.
strata kv count
db.kv.count(prefix: 'Optional[str | bytes]' = None, *, as_of: 'Optional[int]' = None, as_of_time: 'Optional[TimeLike]' = None) -> 'int'
Counts visible KV keys in the selected branch and space, optionally constrained by a key prefix.
To see the complete help for this command, run:
strata kv count --helphelp(db.kv.count)
Example
strata kv put a 1strata kv put b 2strata kv count
_ = db.kv.put("a", "1")_ = db.kv.put("b", "2")db.kv.count()
delete
Delete one visible KV key.
strata kv delete
db.kv.delete(key: 'str | bytes') -> 'Any'
Deletes the current visible value for a KV key. Missing keys produce a no-op delete acknowledgement rather than a read-style missing value.
To see the complete help for this command, run:
strata kv delete --helphelp(db.kv.delete)
Example
strata kv put temp scratchstrata kv delete tempstrata kv exists temp
_ = db.kv.put("temp", "scratch")_ = db.kv.delete("temp")db.kv.exists("temp")
exists
Check whether one KV key exists.
strata kv exists
db.kv.exists(key: 'str | bytes') -> 'bool'
Returns a boolean status for one KV key without loading the stored value.
To see the complete help for this command, run:
strata kv exists --helphelp(db.kv.exists)
Example
strata kv put k vstrata kv exists kstrata kv exists absent
_ = db.kv.put("k", "v")db.kv.exists("k")db.kv.exists("absent")
get
Read the current or historical value for one KV key.
strata kv get
db.kv.get(key: 'str | bytes', *, as_of: 'Optional[int]' = None, as_of_time: 'Optional[TimeLike]' = None) -> 'Optional[bytes]'
Reads one KV key from the selected branch and space. The optional timestamp reads the value visible at that point in time when history is retained.
To see the complete help for this command, run:
strata kv get --helphelp(db.kv.get)
Example
strata kv put greeting hellostrata kv get greetingstrata kv get absent
_ = db.kv.put("greeting", "hello")db.kv.get("greeting")db.kv.get("absent") is None
history
Read retained version history for one KV key.
strata kv history
db.kv.history(key: 'str | bytes') -> 'Optional[list]'
Returns retained history rows for a KV key when history is available. Missing or unavailable history maps to an optional-read result.
To see the complete help for this command, run:
strata kv history --helphelp(db.kv.history)
Example
strata kv history absentdb.kv.history("absent") is Nonelist
List KV keys with optional prefix filtering.
strata kv list
db.kv.keys(prefix: 'Optional[str | bytes]' = None, *, limit: 'Optional[int]' = None, cursor: 'Optional[Any]' = None, as_of: 'Optional[int]' = None, as_of_time: 'Optional[TimeLike]' = None) -> 'Page'
Lists visible KV keys in byte order. Prefix, cursor, limit, and timestamp parameters constrain the page returned by the executor.
To see the complete help for this command, run:
strata kv list --helphelp(db.kv.keys)
Example
strata kv put user:1 astrata kv put user:2 bstrata kv put other cstrata kv list --prefix user:
_ = db.kv.put("user:1", "a")_ = db.kv.put("user:2", "b")_ = db.kv.put("other", "c")db.kv.keys("user:").items
put
Store or replace a KV value by key.
strata kv put
db.kv.put(key: 'str | bytes', value: 'str | bytes') -> 'Any'
Writes a binary value to the selected KV space. If the key already exists, Strata replaces the visible value and records a new version.
To see the complete help for this command, run:
strata kv put --helphelp(db.kv.put)
Example
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")
sample
Sample visible KV rows.
strata kv sample
db.kv.sample(prefix: 'Optional[str | bytes]' = None, *, count: 'Optional[int]' = None) -> 'Sample'
Returns a deterministic bounded sample of visible KV rows plus the total matching count.
To see the complete help for this command, run:
strata kv sample --helphelp(db.kv.sample)
Example
strata kv put a 1strata kv put b 2strata kv put c 3strata kv sample
_ = db.kv.put("a", "1")_ = db.kv.put("b", "2")_ = db.kv.put("c", "3")db.kv.sample().total_count
scan
Scan KV rows with values and version facts.
strata kv scan
db.kv.scan(start: 'Optional[str | bytes]' = None, *, limit: 'Optional[int]' = None, cursor: 'Optional[Any]' = None) -> 'Page'
Scans visible KV rows starting at an optional key. Each item includes the key, value, and commit metadata exposed by the executor output.
To see the complete help for this command, run:
strata kv scan --helphelp(db.kv.scan)
Example
strata kv put a 1strata kv put b 2strata kv scan
_ = db.kv.put("a", "1")_ = db.kv.put("b", "2")[row.key for row in db.kv.scan()]