psql_connect.Rd
Connect to a database, either supply connection details though a config file or connect to local default database.
A string of a file path to the yaml configuration file.
The default value grabs the file path from the psql.config_path option
and uses NULL
if no value supplied.
A string of the name of value. The default value grabs
the value from the psql.config_value option and uses "default"
if no
value is supplied.
An S4 object that inherits from DBIConnection.
The yml file can contain connection details for: host, port, dbname,
user and password. The host, database name, user name and password should
be passed as string. The port is passed as an integer. The function uses
config::get()
to read the config file, check there for more information
on reading in the config data.
If no config details are passed it will connect to your local cluster.
Set the values for psql.config_path
and psql.config_value
for the
function to grab config details. The values can be set options()
.
if (FALSE) { # \dontrun{
conn <- psql_connect()
DBI::dbDisconnect(conn)
psql_connect("config.yml")
DBI::dbDisconnect(conn)
psql_connect(config_path = "config.yml", config_value = "database")
DBI::dbDisconnect(conn)
} # }