Skip to content

Commit

Permalink
add portal_meta_read_athena
Browse files Browse the repository at this point in the history
  • Loading branch information
pdiakumis committed Sep 26, 2023
1 parent 268e8c2 commit 8213fc2
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Imports:
assertthat,
cli,
data.table,
DBI,
dplyr,
emojifont,
fs,
Expand All @@ -41,6 +42,7 @@ Imports:
purrr,
R6,
readr,
RAthena,
RJSONIO,
rlang,
rmarkdown,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export(multiqc_parse_xyline_plot)
export(multiqc_parse_xyline_plot_contig_cvg)
export(multiqc_tidy_json)
export(portal_meta_read)
export(portal_meta_read_athena)
export(rdf2tab)
export(read)
export(s3_files_list_filter_relevant)
Expand Down
30 changes: 30 additions & 0 deletions R/portal_meta.R
Original file line number Diff line number Diff line change
Expand Up @@ -528,3 +528,33 @@ portal_meta_read <- function(pmeta = NULL, rows = 100, params = "", account = "p
end = lubridate::with_tz(.data$end, tz = au_tz)
)
}

#' Read ICA Workflows Metadata via Athena
#'
#' Reads the ICA Workflows Metadata for the given workflow run IDs.
#'
#' @param wfrids Character vector of wfr IDs to query.
#'
#' @return Tibble with a row per wfr ID.
#'
#' @examples
#' \dontrun{
#' wfrids <- c("wfr.1e764ca00e7a43a69e2424f250a34868")
#' portal_meta_read_athena(wfrids)
#' }
#' @export
portal_meta_read_athena <- function(wfrids = NULL) {
assertthat::assert_that(!is.null(wfrids), all(grepl("^wfr\\.", wfrids)))
RAthena::RAthena_options(clear_s3_resource = FALSE)
con <- DBI::dbConnect(
RAthena::athena(),
work_group = "data_portal",
rstudio_conn_tab = FALSE
)
wfrids_quote <- paste(shQuote(wfrids), collapse = ", ")
q1 <- glue(
'SELECT * FROM "data_portal"."data_portal"."data_portal_workflow" where wfr_id in ({wfrids_quote});'
)
RAthena::dbGetQuery(con, q1) |>
tibble::as_tibble()
}
23 changes: 23 additions & 0 deletions man/portal_meta_read_athena.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8213fc2

Please sign in to comment.