Skip to main content
The KV sub-client provides access to the IYREE Key-Value store. Store, retrieve, update, and delete JSON documents organized by variables (namespaces).

Methods

get

Retrieve a document by key.

Parameters

str
required
KV store variable (namespace).
str
required
Document key.

Returns KvDocument

str
Document key.
Any
Arbitrary document payload (typically a dict).
datetime
Creation timestamp.
datetime
Last modification timestamp.
datetime
Expiry timestamp, or None if the document does not expire.

Errors


put

Create or update a document. Returns the document key.

Parameters

str
required
KV store variable (namespace).
Any
required
Document payload. Any JSON-serializable value.
str
Document key. If None, the server auto-generates a key.
Dict[str, Any]
Optional index fields for querying documents.
int
Time-to-live in seconds. The document expires after this duration.
bool
default:"True"
If True (default), overwrite an existing document with the same key. If False, the request fails when the key already exists.

Returns str

The document key (same as key if provided, or the auto-generated key).

delete

Delete a document by key.

Parameters

str
required
KV store variable (namespace).
str
required
Document key.

Returns bool

Always True after a successful deletion.

exists

Check whether a document exists. Does not raise on 404 — returns False instead.

Parameters

str
required
KV store variable (namespace).
str
required
Document key.

Returns bool

True if the document exists, False otherwise.

patch

Partially update a document. Supports setting, unsetting, and incrementing fields.

Parameters

str
required
KV store variable (namespace).
str
required
Document key.
Dict[str, Any]
Fields to set or overwrite.
List[str]
Field names to remove from the document.
Dict[str, Any]
Fields to increment by a numeric value.
Dict[str, Any]
Index fields to update.

Returns KvDocument

The updated document.

list

List documents with optional filtering, ordering, and cursor-based pagination. Filter on secondary indexes using where conditions.

Parameters

str
required
KV store variable (namespace).
List[Dict[str, Any]]
Filter conditions on secondary indexes. Each dict should contain:
Dict[str, str]
Sort directive.
int
default:"100"
Maximum documents per page (1–1000).
str
Opaque cursor from a previous page for pagination. Use page.cursor from the previous result.
List[str]
Subset of top-level data keys to return. When specified, only these fields are included in doc.data.

Returns KvListResult

List[KvDocument]
Documents in this page.
str
Opaque cursor for the next page, or None if this is the last page.
bool
Whether more pages are available.

list_iter

Auto-paginating iterator over all documents matching the query. Handles cursor pagination automatically.

Parameters

str
required
KV store variable (namespace).
List[Dict[str, Any]]
Filter conditions on secondary indexes (same structure as list).
Dict[str, str]
Sort directive (same structure as list).
int
default:"100"
Maximum documents per page (controls internal page size).
List[str]
Subset of top-level data keys to return.

Yields KvDocument

Yields individual KvDocument instances across all pages.

bulk_get

Fetch multiple documents by keys in a single request.

Parameters

str
required
KV store variable (namespace).
List[str]
required
Document keys to fetch.

Returns Dict[str, KvDocument]

A dict mapping each found key to its KvDocument. Keys that do not exist are omitted from the result.

bulk_put

Create or upsert multiple documents in a single request.

Parameters

str
required
KV store variable (namespace).
List[Dict[str, Any]]
required
List of document dicts. Each dict must contain at minimum a data key.
bool
default:"True"
If True (default), overwrite existing documents with the same key.

Returns List[str]

List of document keys in the same order as the input items.

Examples