cred: Create databse credentials object

Description Usage Arguments Value Examples

Description

Combine all the required elements to create a databse connection into a single object. Options can be set interatively via qlog_loud, qlog_silent, and dbwarn.

Retrieve database credentials from a structured JSON and create a db_credentials object

Retrieve database credentials from a file. Uses cred_json to parse.

Retrieve database credentials from a system environment variable. Uses cred_json to parse.

Force queries to be logged or not, regardless of the other settings.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
cred(user, password, host, dbname, port = NA, engine = NA, .qlog = NA,
  .show_warn = NA)

cred_json(json)

cred_file(file)

cred_env(var_name)

qlog_loud(.db = NULL)

qlog_silent(.db = NULL)

Arguments

user

database username

password

databse password

host

database server hostname

dbname

database name to connect to

port

databse server port number

engine

specify database engine to use

.qlog

force logging of queries to console

.show_warn

show warnings from running query, usually typecasting. See dbwarn

json

JSON credentials string.

file

filepath to JSON credentials file

var_name

system variable name

.db

credentials used for this query, if NULL, default is used

Value

a db_credentials object

Examples

1
2
3
4
5
cred("bob","passwd","127.0.0.1","foo")

json <- paste0('{"user": "usr", "password": "pass123", "host": "127.0.0.1",',
               ' "dbname": "foo"}')
foo <- cred_json(json)

acjackman/dbezr documentation built on May 10, 2019, 5:11 a.m.