| Type: | Package |
| Title: | User-Friendly PostgreSQL Connection Management |
| Version: | 0.3.2 |
| Maintainer: | Bobby Fatemi <bfatemi07@gmail.com> |
| Description: | Provides a user-friendly interface for managing PostgreSQL database connection settings. The package supplies helper functions to create, edit and load connection and option configuration files stored in a user-specific directory using the 'odbc' and 'RPostgres' back ends. These helpers make it easy to construct a reproducible connection string from a configuration file, either by reading user-defined YAML files or by parsing an environment variable. |
| Encoding: | UTF-8 |
| License: | MIT + file LICENSE |
| Language: | en-US |
| RoxygenNote: | 7.3.3 |
| Depends: | R (≥ 4.1.0) |
| URL: | https://github.com/r-data-science/rpgconn |
| BugReports: | https://github.com/r-data-science/rpgconn/issues |
| Imports: | DBI, fs, RPostgres, stringr, usethis, yaml |
| Suggests: | rstudioapi, spelling, testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Packaged: | 2025-10-16 13:07:41 UTC; bobbyf |
| Author: | Bobby Fatemi [aut, cre] |
| Repository: | CRAN |
| Date/Publication: | 2025-10-16 14:30:02 UTC |
Database Connect/Disconnect
Description
Database Connect/Disconnect
Usage
dbc(cfg = NULL, db = NULL, args_only = FALSE, cfg_path = NULL, opt_path = NULL)
dbd(cn)
init_yamls()
dir_rpg()
edit_config()
edit_options()
Arguments
cfg |
a connection config name used when loading connection args from internally stored yaml |
db |
Database name. Default of NULL will utilize the dbname in the connection string |
args_only |
If TRUE, only return the connection arguments (Default FALSE will make the connection) |
cfg_path |
optional path to override default db config file. |
opt_path |
optional path to override default db options file. |
cn |
a database connection object |
Value
dbc returns a database connection object or a list of connection arguments while dbd returns nothing
Functions
-
dbc(): Connect to a database or return the connection arguments -
dbd(): Disconnect from a database -
init_yamls(): Initialize connection files -
dir_rpg(): get the path to the rpg settings directory -
edit_config(): edit the internally configured connection parameters -
edit_options(): edit the internally configured connection options
Examples
# cn <- dbc("mydb") # Connect
# dbd(cn) # Disconnect
Use New Config at Path
Description
Use New Config at Path
Usage
use_config(path, overwrite = FALSE)
Arguments
path |
path to new config yaml file to use |
overwrite |
overwrite existing config yaml set prior. Default FALSE |
Value
Invisible character vector giving the path to the active configuration file after it has been replaced. In non-interactive sessions the file is silently returned.