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 eachDimensionElement
in aDimensionUniverse
, and are accessible via theDimensionElement.RecordClass
attribute. TheDimensionRecord
base class itself is pure abstract, but does not use theabc
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 theDimensionElement
;timespan
is a property that returns aTimespan
, 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.Instances are usually obtained from a
Registry
, but in the rare cases where they are constructed directly in Python (usually for insertion into aRegistry
), thefromDict
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
.
- mapping :