R/postgres.R

Defines functions postgres

Documented in postgres

#' serves as a nested call within gradeup::query()
#'
#' postgres serves as a nested call within gradeup::query(). Note that you need to make sure the workstation is connected to the right VPN to access the kidapt database
#' @param config_file is the config file storing all of your passwords and credentials. It is based on the config_local.yml file in the project's root directory.
#' @keywords database postgres query
#' @export
#' @examples
#' query(postgres, "select * from question_answer limit 6")

postgres <- function(config_file = here::here("config.yml")){
  server <- config::get(file = config_file)

  DBI::dbConnect(
    RPostgreSQL::PostgreSQL(),
    user = server$db_postgres$user,
    password = server$db_postgres$password,
    dbname = server$db_postgres$dbname,
    host = server$db_postgres$host
  )
}
Kidapt/keda documentation built on Nov. 23, 2019, 3:35 a.m.