sherlock.database module ∞
the database object for sherlock, setting up ssh tunnels and various database connections
- Author
David Young
-
class
database
(log, settings=False)[source] ∞ Bases:
object
the database object for sherlock, setting up ssh tunnels and various database connections
- The returned dictionary of database connections contain the following databases:
transients
– the database hosting the transient source datacatalogues
– connection to the database hosting the contextual catalogues the transients are to be crossmatched against
Key Arguments
log
– loggersettings
– the settings dictionary
Return
dbConns
– a dictionary of the database connections required by sherlock
Usage
To setup the sherlock database connections, run the following:
# SETUP ALL DATABASE CONNECTIONS from sherlock import database db = database( log=log, settings=settings ) dbConns, dbVersions = db.connect() transientsDbConn = dbConns["transients"] cataloguesDbConn = dbConns["catalogues"]
- update key arguments values and definitions with defaults - update return values and definitions - update usage examples and text - update docstring text - check sublime snippet exists - clip any useful text to docs mindmap - regenerate the docs and check redendering of this docstring
-
connect
()[source] ∞ connect to the various databases, the credientals and settings of which are found in the sherlock settings file
Return
transientsDbConn
– the database hosting the transient source datacataloguesDbConn
– connection to the database hosting the contextual catalogues the transients are to be crossmatched against
See the class docstring for usage
- update key arguments values and definitions with defaults - update return values and definitions - update usage examples and text - update docstring text - check sublime snippet exists - clip any useful text to docs mindmap - regenerate the docs and check redendering of this docstring
-
_setup_tunnel
(tunnelParameters)[source] ∞ setup a ssh tunnel for a database connection to port through
Key Arguments
tunnelParameters
– the tunnel parameters found associated with the database settings
Return
sshPort
– the port the ssh tunnel is connected via
- update key arguments values and definitions with defaults - update return values and definitions - update usage examples and text - update docstring text - check sublime snippet exists - clip any useful text to docs mindmap - regenerate the docs and check redendering of this docstring
-
_checkServer
(address, port)[source] ∞ Check that the TCP Port we’ve decided to use for tunnelling is available
- update key arguments values and definitions with defaults - update return values and definitions - update usage examples and text - update docstring text - check sublime snippet exists - clip any useful text to docs mindmap - regenerate the docs and check redendering of this docstring