Skip to contents

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

Usage

ledgr_snapshot_list(con, status = NULL)

Arguments

con

A DBI connection to DuckDB or a path to a DuckDB snapshot file. This function does not accept a ledgr_snapshot object; use ledgr_snapshot_info(snapshot) for a single snapshot handle.

status

Optional status filter (NULL for all, or one/more of CREATED, SEALED, FAILED).

Value

A tibble with snapshot metadata and counts.

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 status is not NULL or contains invalid values.

Examples

db_path <- tempfile(fileext = ".duckdb")
con <- ledgr_db_init(db_path)
ledgr_snapshot_create(con, snapshot_id = "snapshot_20200101_000000_abcd")
#> [1] "snapshot_20200101_000000_abcd"
ledgr_snapshot_list(con)
#> # A tibble: 1 × 9
#>   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
#> # ℹ 3 more variables: instrument_count <int>, meta_json <chr>, error_msg <chr>
ledgr_snapshot_list(db_path)
#> # A tibble: 1 × 9
#>   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
#> # ℹ 3 more variables: instrument_count <int>, meta_json <chr>, error_msg <chr>
DBI::dbDisconnect(con, shutdown = TRUE)