R/create_lazy_conn.R

Defines functions create_lazy_conn

Documented in create_lazy_conn

#'
#' Create a lazy connection to a table in a schema
#'
#' @param pool_conn A pool connection to a PostgreSQL database
#' @param schemaname The schema from which to get the tables. Default is public
#' @param tablename The name of the table to create the connection to
#' @return A pool connection object
#'
#' @export
#'
#' @import dplyr
#'
create_lazy_conn <- function(pool_conn, schemaname = "public", tablename) {
  lazy_conn <- pool_conn %>% dplyr::tbl(dbplyr::in_schema(schemaname, tablename))
  return(lazy_conn)
}
Aypak/dbhelpers documentation built on Jan. 25, 2024, 9:03 p.m.