Skip to contents

Returns snapshot metadata plus computed row counts for bars and instruments. This function does not mutate the database.

Usage

ledgr_snapshot_info(con, snapshot_id)

Arguments

con

A DBI connection to DuckDB or a ledgr_snapshot.

snapshot_id

Snapshot id (must exist) when con is a connection.

Value

A 1-row tibble with: snapshot_id, status, created_at_utc, sealed_at_utc, snapshot_hash, bar_count, instrument_count, start_date, end_date, meta_json, error_msg.

bar_count and instrument_count are live counts from the snapshot tables. start_date and end_date are parsed from seal metadata when present. meta_json remains available as the raw envelope metadata written on the snapshot row. Metadata is not part of snapshot_hash.

Details

Timestamps are returned as ISO8601 UTC strings with trailing Z.

Errors:

  • ledgr_invalid_con if con is not a valid DBI connection.

  • ledgr_invalid_args if snapshot_id is not a non-empty character scalar.

  • LEDGR_SNAPSHOT_NOT_FOUND if snapshot_id does not exist.

Articles

Durable experiment stores: vignette("experiment-store", package = "ledgr") system.file("doc", "experiment-store.html", package = "ledgr")

Examples

db_path <- tempfile(fileext = ".duckdb")
con <- ledgr_db_init(db_path)
snapshot_id <- ledgr_snapshot_create(
  con,
  snapshot_id = "snapshot_20200101_000000_abcd"
)
ledgr_snapshot_info(con, snapshot_id)
#> # A tibble: 1 × 11
#>   snapshot_id        status created_at_utc sealed_at_utc snapshot_hash bar_count
#>   <chr>              <chr>  <chr>          <chr>         <chr>             <int>
#> 1 snapshot_20200101… CREAT… 2026-05-15T16… NA            NA                    0
#> # ℹ 5 more variables: instrument_count <int>, start_date <chr>, end_date <chr>,
#> #   meta_json <chr>, error_msg <chr>
DBI::dbDisconnect(con, shutdown = TRUE)