connect_db | R Documentation |
Used to connect to the databases using a configuration file - for unix and windows
The credentials are stored in an external file in the home directory ~
.
On Unix: Edit the credentials with file.edit("~/config.yml")
.
On Windows: Edit the credentials with file.edit("~/.my.cnf")
.
connect_db( credential_name = "db_local", package = "DBI", config_path = "~/config.yml", default.file.windows = "~/.my.cnf" )
credential_name |
Credential identification in the configuration file,
example |
package |
The package to be used: DBI or dbx |
config_path |
Path to the credential file,
example: |
default.file.windows |
Path to the configuration file in windows
example: |
What inside .yml file?
What inside .cnf file?
Something like that: https://gist.github.com/rhtyd/d59078be4dc88123104e
connect_db() # this connect to factfield_data db_main auto using the credential from the yml data.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.