# Run mysql query from file
dbGetQuery__ %mockable% DBI::dbGetQuery
#' @export
run_file_query <- function(con, qfile, ...){
assertive::assert_all_are_readable_files(qfile)
qstr <- stringr::str_c(readLines(qfile), collapse = '\n')
dots <- list(...)
dots <- dots[!sapply(dots, is.na)]
call_args <- list(qstr)
if(length(dots) > 0){
call_args <- c(call_args, dots)
}
qstr <- do.call('sprintf', call_args)
out_df <- suppressWarnings(saf_off(dbGetQuery__(con, qstr)))
return(out_df)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.