Retrieves data from a DuckLake table at a specific snapshot ID using DuckLake's AT (VERSION => ...) syntax.
Arguments
- table_name
The name of the table to query
- version
The snapshot_id to query (get this from
list_table_snapshots())- conn
Optional DuckDB connection object. If not provided, uses the default ducklake connection.
Details
This function allows you to query a specific snapshot of a table using its snapshot_id.
This uses the syntax: SELECT * FROM table AT (VERSION => snapshot_id)
Each time you create or modify a table within a transaction, DuckLake creates a new snapshot with a unique snapshot_id. Note that snapshot_id and schema_version are typically the same value - both represent the snapshot identifier.
Use list_table_snapshots(table_name) to see all available snapshots and their IDs.
Examples
if (FALSE) { # \dontrun{
# Get available snapshots
snapshots <- list_table_snapshots("my_table")
# Query the first snapshot version
get_ducklake_table_version("my_table", snapshots$snapshot_id[1]) |>
filter(status == "active") |>
collect()
} # }
