DimensionRecord

class lsst.daf.butler.DimensionRecord(*args)

Bases: object

Base class for the Python representation of database records for a DimensionElement.

Parameters:
args

Field values for this record, ordered to match __slots__.

Notes

DimensionRecord subclasses are created dynamically for each DimensionElement in a DimensionUniverse, and are accessible via the DimensionElement.RecordClass attribute. The DimensionRecord base class itself is pure abstract, but does not use the abc module to indicate this because it does not have overridable methods.

Record classes have attributes that correspond exactly to the fields in the related database table, a few additional methods inherited from the DimensionRecord base class, and two additional injected attributes:

  • definition is a class attribute that holds the DimensionElement;
  • timespan is a property that returns a Timespan, present only on record classes that correspond to temporal elements.

The field attributes are defined via the __slots__ mechanism, and the __slots__ tuple itself is considered the public interface for obtaining the list of fields. It is guaranteed to be equal to DimensionElement.makeTableSpec().fields.names when makeTableSpec does not return None.

Instances are usually obtained from a Registry, but in the rare cases where they are constructed directly in Python (usually for insertion into a Registry), the fromDict method should generally be used.

DimensionRecord instances are immutable.

Attributes Summary

dataId A dict-like identifier for this record’s primary keys (DataCoordinate).

Methods Summary

fromDict(mapping, Any]) Construct a DimensionRecord subclass instance from a mapping of field values.
toDict() Return a vanilla dict representation of this record.

Attributes Documentation

dataId

A dict-like identifier for this record’s primary keys (DataCoordinate).

Methods Documentation

classmethod fromDict(mapping: Mapping[str, Any])

Construct a DimensionRecord subclass instance from a mapping of field values.

Parameters:
mapping : Mapping

Field values, keyed by name. The keys must match those in __slots__, with the exception that a dimension name may be used in place of the primary key name - for example, “tract” may be used instead of “id” for the “id” primary key field of the “tract” dimension.

Returns:
record : DimensionRecord

An instance of this subclass of DimensionRecord.

toDict() → Dict[str, Any]

Return a vanilla dict representation of this record.