R/get_metadata.R

Defines functions get_metadata

Documented in get_metadata

################################################################################
#
#'
#' Get remote table metadata
#'
#' @param x An object of class `tbl_lazy` produced by [get_table()]
#'
#' @return A named list of remote table metadata
#'
#' @author Ernest Guevarra
#'
#' @examples
#' x <- get_table(con = connect_oxcovid19(), tbl_name = "epidemiology")
#' get_metadata(x)
#'
#' @export
#'
#
################################################################################

get_metadata <- function(x) {
  md <- list(dbplyr::remote_name(x),
             dbplyr::remote_src(x),
             dbplyr::remote_con(x),
             dbplyr::remote_query(x),
             dbplyr::remote_query_plan(x))

  names(md) <- c("Name", "Source", "DBI connection", "Query text", "Query plan")

  return(md)
}

Try the oxcovid19 package in your browser

Any scripts or data that you put into this service are public.

oxcovid19 documentation built on Jan. 13, 2021, 8:50 p.m.