Dimension

class lsst.daf.butler.Dimension

Bases: DimensionElement

A dimension.

A named data-organization concept that can be used as a key in a data ID.

Attributes Summary

alternateKeys

Return alternate keys.

alternate_keys

Additional unique key fields for this dimension element that are not the primary key (NamedValueAbstractSet of KeyColumnSpec).

populated_by

The dimension that this element's records are always inserted, exported, and imported alongside.

primaryKey

Return primary key field for this dimension (FieldSpec).

primary_key

The primary key field for this dimension (KeyColumnSpec).

uniqueKeys

Return the unique fields.

unique_keys

Descriptions of unique identifiers for this dimension.

Methods Summary

to_arrow(dimensions[, spec])

Return an object that converts the primary key value for this dimension to column in an Arrow table.

Attributes Documentation

alternateKeys

Return alternate keys.

Additional unique key fields for this dimension that are not the primary key (NamedValueAbstractSet of FieldSpec).

If this dimension has required dependencies, the keys of those dimensions are also included in the unique constraints defined for these alternate keys.

alternate_keys
populated_by
primaryKey

Return primary key field for this dimension (FieldSpec).

Note that the database primary keys for dimension tables are in general compound; this field is the only field in the database primary key that is not also a foreign key (to a required dependency dimension table).

primary_key

The primary key field for this dimension (KeyColumnSpec).

Note that the database primary keys for dimension tables are in general compound; this field is the only field in the database primary key that is not also a foreign key (to a required dependency dimension table).

uniqueKeys

Return the unique fields.

All fields that can individually be used to identify records of this element, given the primary keys of all required dependencies (NamedValueAbstractSet of FieldSpec).

unique_keys

Descriptions of unique identifiers for this dimension.

All fields that can individually be used to identify records of this element, given the primary keys of all required dependencies (NamedValueAbstractSet of KeyColumnSpec).

Methods Documentation

to_arrow(dimensions: DimensionGroup, spec: KeyColumnSpec | None = None) arrow_utils.ToArrow

Return an object that converts the primary key value for this dimension to column in an Arrow table.

Parameters:
dimensionsDimensionGroup

Full set of dimensions over which the rows of the table are unique or close to unique. This is used to determine whether to use Arrow’s dictionary encoding to compress duplicate values.

specKeyColumnSpec, optional

Column specification for this dimension. If not provided, a copy of primary_key the the field name replaced with the dimension name will be used, which is appropriate for when this dimension appears in data ID or the dimension record tables of other dimension elements.

Returns:
converterarrow_utils.ToArrow

Converter for this dimension’s primary key.