fundamentals.mysql.setup_database_connection¶
Given a yaml settings file containing database connection details, setup and return the db connector
- Author
David Young
Module Contents¶
Functions¶
Start a database connection using settings in yaml file |
API¶
- fundamentals.mysql.setup_database_connection.setup_database_connection(pathToYamlFile)[source][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 )