lsst.daf.persistence  19.0.0-7-gbea9075+7
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.daf.persistence.registries.SqlRegistry Class Reference
Inheritance diagram for lsst.daf.persistence.registries.SqlRegistry:
lsst.daf.persistence.registries.Registry lsst.daf.persistence.registries.PgsqlRegistry lsst.daf.persistence.registries.SqliteRegistry

Public Member Functions

def __init__ (self, conn)
 
def __del__ (self)
 
def lookup (self, lookupProperties, reference, dataId, **kwargs)
 
def executeQuery (self, returnFields, joinClause, whereFields, range, values)
 

Static Public Member Functions

def create (location)
 

Public Attributes

 conn
 

Static Public Attributes

string placeHolder = "?"
 

Detailed Description

A base class for SQL-based registries

Subclasses should define the class variable `placeHolder` (the particular
placeholder to use for parameter substitution) appropriately. The
database's python module should define `paramstyle` (see PEP 249), which
would indicate what to use for a placeholder:
* paramstyle = "qmark" --> placeHolder = "?"
* paramstyle = "format" --> placeHolder = "%s"
Other `paramstyle` values are not currently supported.

Constructor parameters
----------------------
conn : DBAPI connection object
    Connection object

Definition at line 288 of file registries.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.daf.persistence.registries.SqlRegistry.__init__ (   self,
  conn 
)
Constructor.

Parameters
----------
conn : DBAPI connection object
    Connection object

Reimplemented in lsst.daf.persistence.registries.PgsqlRegistry, and lsst.daf.persistence.registries.SqliteRegistry.

Definition at line 306 of file registries.py.

◆ __del__()

def lsst.daf.persistence.registries.SqlRegistry.__del__ (   self)

Reimplemented from lsst.daf.persistence.registries.Registry.

Definition at line 317 of file registries.py.

Member Function Documentation

◆ create()

def lsst.daf.persistence.registries.Registry.create (   location)
staticinherited
Create a registry object of an appropriate type.
@param location (string) Path or URL for registry, or None if
                 unavailable

Definition at line 71 of file registries.py.

◆ executeQuery()

def lsst.daf.persistence.registries.SqlRegistry.executeQuery (   self,
  returnFields,
  joinClause,
  whereFields,
  range,
  values 
)
Extract metadata from the registry.
@param returnFields (list of strings) Metadata fields to be extracted.
@param joinClause   (list of strings) Tables in which metadata fields
            are located.
@param whereFields  (list of tuples) First tuple element is metadata
            field to query; second is the value that field
            must have (often '?').
@param range        (tuple) Value, lower limit, and upper limit for a
            range condition on the metadata.  Any of these can
            be metadata fields.
@param values       (tuple) Tuple of values to be substituted for '?'
            characters in the whereFields values or the range
            values.
@return (list of tuples) All sets of field values that meet the
criteria

Definition at line 368 of file registries.py.

◆ lookup()

def lsst.daf.persistence.registries.SqlRegistry.lookup (   self,
  lookupProperties,
  reference,
  dataId,
**  kwargs 
)
Perform a lookup in the registry.

Return values are refined by the values in dataId.
Returns a list of values that match keys in lookupProperties.
e.g. if the template is 'raw/raw_v%(visit)d_f%(filter)s.fits.gz', and
dataId={'visit':1}, and lookupProperties is ['filter'], and the
filesystem under self.root has exactly one file 'raw/raw_v1_fg.fits.gz'
then the return value will be [('g',)]

:param lookupProperties:
:param dataId: must be an iterable. Keys must be string.
If key is a string then will look for elements in the repository that match value for key.
If key is a 2-item iterable then will look for elements in the repository where the value is between
the values of key[0] and key[1].
:param reference: other data types that may be used to search for values.
:param **kwargs: nothing needed for sqlite lookup
:return: a list of values that match keys in lookupProperties.

Definition at line 322 of file registries.py.

Member Data Documentation

◆ conn

lsst.daf.persistence.registries.SqlRegistry.conn

Definition at line 315 of file registries.py.

◆ placeHolder

string lsst.daf.persistence.registries.SqlRegistry.placeHolder = "?"
static

Definition at line 304 of file registries.py.


The documentation for this class was generated from the following file: