Skip to contents

Retrieves the n most recent run records for a given dataset from the snapshot database, ordered newest-first.

Usage

read_recent_snapshots(db_path, dataset_name, n = 10)

Arguments

db_path

Character. Path to the SQLite database file.

dataset_name

Character. Dataset name to filter on.

n

Integer. Maximum number of records to return. Defaults to 10.

Value

A data frame with one row per run and columns including id, dataset_name, run_timestamp, file_name, row_count, col_count, overall_status, check_pass_count, check_warn_count, check_fail_count, check_info_count, new_cols_vs_previous, missing_cols_vs_previous, new_cols_vs_schema, missing_cols_vs_schema, comparison_mode, render_status, type_changed_cols_vs_previous, and report_file (the rendered report's filename, NA for snapshots written before dqcheckr 0.2.3). render_status is one of "pending" (0.2.5+: the row was written but its report has not finished rendering yet – report_file is NA in this window), "success" (report written; report_file names it), or "failed" (render skipped or errored; report_file is NA). Consumers linking to a report should treat a "pending" row as not-yet-available rather than reconstructing a filename for a report that does not exist. Returns an empty data frame with the same columns if the database does not exist or contains no records for the dataset. If the database exists but cannot be read (corrupt file, permissions, an unresolved lock), it emits a warning naming the cause and returns the same empty data frame, so a read failure is visible rather than masquerading as an empty history.

Examples

history <- read_recent_snapshots(tempfile(fileext = ".sqlite"), "starwars_csv")