Skip to contents

Name-based wrapper around read_recent_snapshots: resolves the snapshot database from the dataset's configuration exactly as run_dq_check does (the merged global + dataset config's snapshot_db, defaulting to "data/snapshots.sqlite"), so the whole workflow can be driven by dataset names without ever hand-typing a database path. The returned id column is the snapshot id that compare_snapshots takes to compare a specific pair of runs.

Usage

list_runs(dataset_name, config_dir = ".", n = 10)

Arguments

dataset_name

Character. Dataset name; must match <dataset_name>.yml in config_dir.

config_dir

Character. Path to the directory containing dqcheckr.yml and the dataset YAML file. Defaults to ".".

n

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

Value

The data frame documented in read_recent_snapshots: one row per run, most recent first, empty (with the full column schema) when the database does not exist or holds no rows for the dataset.

Note

As with run_dq_check, a relative snapshot_db resolves against the R process's working directory, not against config_dir. Call from the deployment root or use an absolute path in the config, or the lookup will (like a run started from the wrong directory) point at a database that isn't the deployment's.

Examples

tmp <- gsub("\\\\", "/", tempdir())
writeLines(paste0('snapshot_db: "', tmp, '/snap.sqlite"'),
           file.path(tmp, "dqcheckr.yml"))
writeLines(c('dataset_name: "demo"', 'format: csv'),
           file.path(tmp, "demo.yml"))
list_runs("demo", config_dir = tmp)   # empty frame: no runs recorded yet
#>  [1] id                            dataset_name                 
#>  [3] run_timestamp                 file_name                    
#>  [5] row_count                     col_count                    
#>  [7] check_pass_count              check_warn_count             
#>  [9] check_fail_count              check_info_count             
#> [11] overall_status                new_cols_vs_previous         
#> [13] missing_cols_vs_previous      new_cols_vs_schema           
#> [15] missing_cols_vs_schema        comparison_mode              
#> [17] render_status                 type_changed_cols_vs_previous
#> [19] report_file                  
#> <0 rows> (or 0-length row.names)