Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Commit 7c6aaa0

Browse files
committed
Download a compressed version of the SQLite
1 parent e9c30e4 commit 7c6aaa0

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

R/query.R

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,17 +408,25 @@ get_metadata <- function(
408408
#' @importFrom RSQLite SQLite SQLITE_RO
409409
#' @importFrom dplyr tbl
410410
#' @importFrom httr progress
411+
#' @importFrom cli cli_alert_info
411412
#'
412413
get_metadata_local <- function(
413-
remote_url = "https://object-store.rc.nectar.org.au/v1/AUTH_06d6e008e3e642da99d806ba3ea629c5/metadata-sqlite/metadata.sqlite",
414+
remote_url = "https://object-store.rc.nectar.org.au/v1/AUTH_06d6e008e3e642da99d806ba3ea629c5/metadata-sqlite/metadata.tar.xz",
414415
cache_directory = get_default_cache_dir()
415416
) {
417+
tar_path <- file.path(cache_directory, "metadata.tar.xz")
416418
sqlite_path <- file.path(cache_directory, "metadata.sqlite")
417-
sync_remote_file(
418-
remote_url,
419-
sqlite_path,
420-
progress(type = "down", con = stderr())
421-
)
419+
if (!file.exists(sqlite_path)){
420+
tar_dir <- tempdir()
421+
tar_file <- file.path(tar_dir, "metadata.tar.xz")
422+
sync_remote_file(
423+
remote_url,
424+
tar_file,
425+
progress(type = "down", con = stderr())
426+
)
427+
cli_alert_info("Decompressing tar archive")
428+
untar(tar_file, exdir = cache_directory)
429+
}
422430
SQLite() |>
423431
dbConnect(drv = _, dbname = sqlite_path, flags = SQLITE_RO) |>
424432
tbl("metadata")

0 commit comments

Comments
 (0)