Read model inspection with Cratis CLI
A read model is projected state built from events by an observer. Chronicle maintains read model instances in storage and updates them as new events arrive. Each instance is identified by a key — typically an event source ID — and contains a document that represents the current state of that entity.
Lists all read model definitions registered in the specified event store and namespace.
cratis chronicle read-models listOptions
Section titled “Options”| Flag | Description |
|---|---|
-e, --event-store <NAME> |
Event store to inspect. Defaults to the active context’s event store, then default. |
-n, --namespace <NAME> |
Accepted but has no effect: read model definitions belong to the event store, not a namespace. |
Output columns
Section titled “Output columns”The table includes a Queryable column (Yes/No) indicating whether the read model stores state server-side and can be inspected with get or instances. Client-owned read models show No — their state lives in the client application and cannot be retrieved through the Chronicle server. The JSON output includes a queryable boolean field for programmatic use.
Output tip
Section titled “Output tip”Use --output plain when enumerating read models.
cratis chronicle read-models list --output plainExamples
Section titled “Examples”List all read models:
cratis chronicle read-models listGet read model names for scripting:
cratis chronicle read-models list -qinstances
Section titled “instances”Lists the stored instances of a read model, with pagination support.
cratis chronicle read-models instances <READ_MODEL>Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
READ_MODEL |
The read model name. Use read-models list -q to retrieve names. |
Options
Section titled “Options”| Flag | Description |
|---|---|
-e, --event-store <NAME> |
Event store to inspect. Defaults to the active context’s event store, then default. |
-n, --namespace <NAME> |
Namespace to inspect. Defaults to the active context’s namespace, then Default. |
--page <NUMBER> |
Zero-based page index. Defaults to 0. |
--page-size <COUNT> |
Number of instances per page. Defaults to 20. |
Examples
Section titled “Examples”List the first page of instances:
cratis chronicle read-models instances UserProfileList the second page with a larger page size:
cratis chronicle read-models instances UserProfile --page 1 --page-size 50Gets a single read model instance by key.
cratis chronicle read-models get <READ_MODEL> <KEY>Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
READ_MODEL |
The read model name. |
KEY |
The instance key, typically an event source ID. |
Options
Section titled “Options”| Flag | Description |
|---|---|
-e, --event-store <NAME> |
Event store to inspect. Defaults to the active context’s event store, then default. |
-n, --namespace <NAME> |
Namespace to inspect. Defaults to the active context’s namespace, then Default. |
--sequence <NAME> |
Event sequence associated with the read model. Defaults to the event log. |
Examples
Section titled “Examples”Get a read model instance:
cratis chronicle read-models get UserProfile user-42Get the full document as JSON:
cratis chronicle read-models get UserProfile user-42 -o jsonoccurrences
Section titled “occurrences”Lists the replay history (occurrences) of a read model type, optionally for a specific generation: one row each time it was built or rebuilt, with the observer, when it occurred, the read model type and generation, and the container and revert container names. It does not return a count.
cratis chronicle read-models occurrences <READ_MODEL_TYPE>Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
READ_MODEL_TYPE |
The read model type name. |
Options
Section titled “Options”| Flag | Description |
|---|---|
-e, --event-store <NAME> |
Event store to inspect. Defaults to the active context’s event store, then default. |
-n, --namespace <NAME> |
Namespace to inspect. Defaults to the active context’s namespace, then Default. |
--generation <NUMBER> |
Read model generation to list occurrences for. Defaults to 1. |
Examples
Section titled “Examples”List the replay history of a read model:
cratis chronicle read-models occurrences UserProfileList the replay history of a specific generation:
cratis chronicle read-models occurrences UserProfile --generation 2snapshots
Section titled “snapshots”Lists or retrieves snapshots for a specific read model instance. Snapshots are point-in-time captures of a read model’s state, including the sequence number at which the snapshot was taken.
cratis chronicle read-models snapshots <READ_MODEL> <KEY>Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
READ_MODEL |
The read model name. |
KEY |
The instance key, typically an event source ID. |
Options
Section titled “Options”| Flag | Description |
|---|---|
-e, --event-store <NAME> |
Event store to inspect. Uses the explicit option, then the active context’s event store, then default. |
-n, --namespace <NAME> |
Namespace to inspect. Uses the explicit option, then the active context’s namespace, then Default. |
Examples
Section titled “Examples”List snapshots for an instance:
cratis chronicle read-models snapshots UserProfile user-42Get snapshot details including full documents and event metadata:
cratis chronicle read-models snapshots UserProfile user-42 -o json