r-data-science / rpgconn

Simple Postgres connection function

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rpgconn

Codecov R-CMD-check test-coverage CRAN status

The goal of rpgconn is to provide a simple interface for connecting to a PostgreSQL database.

Installation

You can install the development version of rpgconn like so:

# dev version
devtools::install_github("r-data-science/rpgconn")

Setting RPG_CONN_STRING

The environment variable RPG_CONN_STRING must be set and have the format shown below.

cs <- "user=postgres;password=some_password;host=some_host;port=5432;dbname=postgres"
Sys.setenv(RPG_CONN_STRING = cs)

Installation

install.packages("rpgconn")
# OR
remotes::install_github("r-data-science/rpgconn")

Example

library(rpgconn)
library(DBI)

#open connection
cn <- dbc("some_database")

# List tables
dbListTables(cn)

# Close connection
dbd(cn)

About

Simple Postgres connection function

License:Other


Languages

Language:R 100.0%