fundamentals.mysql.database¶
a database object that can setup up a ssh tunnel (optional) and a database connection
- Author
David Young
Module Contents¶
Classes¶
a database object that can setup up a ssh tunnel (optional) and a database connection |
API¶
- class fundamentals.mysql.database.database(log, dbSettings=False, autocommit=True)[source][source]¶
Bases:
objecta database object that can setup up a ssh tunnel (optional) and a database connection
Key Arguments
log– loggerdbSettings– a dictionary of database settings
Return
dbConns– a database connection
Usage
Given a python dictionary that looks like this:
dbSettings = { 'host': '127.0.0.1', 'loginPath': 'atlasMovers', 'user': 'monster', 'tunnel': { 'remote ip': 'psweb.mp.qub.ac.uk', 'remote datbase host': 'dormammu', 'remote user': 'monster', 'port': 9006 }, 'password': 'myPass', 'db': 'atlas_moving_objects' }
loginPathandtunnelare optional, to setup the a database connection, run the following:# SETUP ALL DATABASE CONNECTIONS from fundamentals.mysql import database dbConn = database( log=log, dbSettings=dbSettings ).connect()
Initialization