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"
)

Arguments

credential_name

Credential identification in the configuration file, example datascience, factfield_data or pubmed

package

The package to be used: DBI or dbx

config_path

Path to the credential file, example: "~/dbconfig.yml"

default.file.windows

Path to the configuration file in windows example: "~/.my.cnf"

Details

What inside .yml file?

default:
factfield_data:
host: 'db_main.factfield.de'
user: '........'
password: '......'
port: 13306
dbname: 'db_main'

What inside .cnf file?

Something like that: https://gist.github.com/rhtyd/d59078be4dc88123104e

Examples

connect_db() # this connect to factfield_data db_main auto using the credential from the yml data.
#> <MariaDBConnection>
#>   Host:    localhost
#>   Server:  
#>   Client: