setup_database_connection (function)

setup_database_connection(pathToYamlFile)[source]

Start a database connection using settings in yaml file

Given the location of a YAML dictionary containing database credientials, this function will setup and return the connection*

Key Arguments

  • pathToYamlFile – path to the YAML dictionary.

Return

  • dbConn – connection to the MySQL database.

Usage

The settings file should be in this form, with all keyword values set:

db: unit_tests
host: localhost
user: utuser
password: utpass

And here’s how to generate the connection object:

from fundamentals.mysql import setup_database_connection
dbConn = setup_database_connection(
    pathToYamlFile=pathToMyYamlFile
)