sherlock.database (class)

class sherlock.database(log, settings=False)[source]

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 data
  • catalogues – connection to the database hosting the contextual catalogues the transients are to be crossmatched against
  • marshall – connection to the PESSTO Marshall database
Key Arguments:
  • log – logger
  • settings – 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"]
pmDbConn = dbConns["marshall"]

Todo

  • 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

Methods

connect() connect to the various databases, the credientals and settings of which are found in the sherlock settings file
_checkServer(address, port) Check that the TCP Port we’ve decided to use for tunnelling is available
_setup_tunnel(tunnelParameters) setup a ssh tunnel for a database connection to port through
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 data
  • cataloguesDbConn – connection to the database hosting the contextual catalogues the transients are to be crossmatched against
  • pmDbConn – connection to the PESSTO Marshall database

See the class docstring for usage

Todo

  • 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

Todo

  • 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

Todo

  • 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