connect_pg: Connect to Postgres Database

View source: R/connect_pg.R

connect_pgR Documentation

Connect to Postgres Database

Description

This is a convenience wrapper to DBI::dbConnect() where if the database credentials are saved in the .REnviron file, they will be automatically read.

Usage

connect_pg(getenv = FALSE, verbose = FALSE, ...)

Arguments

getenv

get credentials from the local .REnviron file

verbose

print database connection information from dbGetInfo()

...

other arguments to pass through dbConnect()

Details

All other arguments pass through dbConnect() except for drv which is already specified to RPostgres::Postgres()

Value

connection to Postgres database

Examples

## Not run: 
connect_pg(getenv = FALSE,
  drv = DBI::dbDriver("Postgres"),
  port = 5432,
  dbname = "mydb",
  user = "myusername",
  password = "mypw"
)

## End(Not run)

eugejoh/pgtools documentation built on Dec. 11, 2022, 4:29 p.m.