sherlock.imports._base_importer (class)

class sherlock.imports._base_importer(log, settings=False, pathToDataFile=False, version=False, catalogueName='', coordinateList=[], radiusArcsec=False)[source]

The base importer object used to import new catalgues into sherlock-catalogues database

Key Arguments:
  • log – logger
  • settings – the settings dictionary
  • pathToDataFIle – path to the file containing the data to import
  • version – version number of the catalogue to be imported (e.g. DR12)
  • catalogueName – name of the catalogue to be imported
  • coordinateList – list of coordinates (needed for some streamed tables)
  • radiusArcsec – the radius in arcsec with which to perform the initial NED conesearch. Default False

Usage:

To use this base class to write a new importer, create your class like so:

class newImporter(_base_importer):
    ...

Methods

add_data_to_database_table(dictList[, …]) Import data in the list of dictionaries in the requested database table
_add_htmids_to_database_table() Add HTMIDs to database table once all the data has been imported (HTM Levels 10,13,16)
_update_database_helper_table() Update the sherlock catalogues database helper table with the time-stamp of when this catlogue was last updated
add_data_to_database_table(dictList, createStatement=False)[source]

Import data in the list of dictionaries in the requested database table

Also adds HTMIDs and updates the sherlock-catalogue database helper table with the time-stamp of when the imported catlogue was last updated

Key Arguments:
  • dictList - a list of dictionaries containing all the rows in the catalogue to be imported
  • createStatement - the table’s mysql create statement (used to generate table if it does not yet exist in database). Default False

Usage:

self.add_data_to_database_table(
    dictList=dictList,
    createStatement=createStatement
)

Todo

  • Write a checklist for creating a new sherlock database importer
_add_htmids_to_database_table()[source]

Add HTMIDs to database table once all the data has been imported (HTM Levels 10,13,16)

Usage:

self._add_htmids_to_database_table()
_update_database_helper_table()[source]

Update the sherlock catalogues database helper table with the time-stamp of when this catlogue was last updated

Usage:

self._update_database_helper_table()