-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
I am using this package as a dependency for a personal project and I am struggling with how to incorperate this package dependency without having to put library(RPostgreSQL) in the function code.
For some context, the code that I uses connects to a PostgreSQL database hosted on the cloud and proceeds to preform some relevant queries.
My code:
database_func<- function(
dsn_database,
dsn_hostname,
dsn_port,
dsn_uid,
dsn_pwd,
...) {
tryCatch({
drv <- dbDriver("PostgreSQL")
print("Connecting to Database…")
connec <- dbConnect(drv,
dbname = dsn_database,
host = dsn_hostname,
port = dsn_port,
user = dsn_uid,
password = dsn_pwd)
print("Database Connected!")
},
error=function(cond) {
print("Unable to connect to Database.")
})
# REST OF CODE ....
}If I don't call library(RPostgreSQL) before I utilize this function, the code breaks as the argument for dbDriver() is invalid.
I tried having RPostGreSQL listed in my package dependencies in my DESCRIPTION file but the problem still persists.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels