TopologicalExtentDatabaseRepresentation¶
- class lsst.daf.butler.TopologicalExtentDatabaseRepresentation¶
- Bases: - Generic[- _R]- Mapping of in-memory representation of a region to DB representation. - An abstract base class whose subclasses provide a mapping from the in-memory representation of a - TopologicalSpaceregion to a database-storage representation, and whose instances act like a SQLAlchemy-based column expression.- Attributes Summary - Return base logical name for the topological extent ( - str).- Methods Summary - extract(mapping[, name])- Extract a region from a dictionary. - flatten(name)- Return the actual column(s) that comprise this logical column. - fromSelectable(selectable[, name])- Construct representation of a column in the table or subquery. - getFieldNames([name])- Return the actual field names used by this representation. - Return - Trueif this representation supports exclusion constraints.- isNull()- Return expression that tests where region is - NULL.- makeFieldSpecs(nullable[, name])- Make objects that reflect the fields that must be added to table. - update(extent[, name, result])- Add a region to a dictionary. - Attributes Documentation - name¶
- Return base logical name for the topological extent ( - str).- If the representation uses only one actual column, this should be the full name of the column. In other cases it is an unspecified subset of the column names. 
 - Methods Documentation - abstract classmethod extract(mapping: Mapping[str, Any], name: str | None = None) _R | None¶
- Extract a region from a dictionary. - This region represents a database row in this representation. - Parameters:
- mappingMapping[str,Any]
- A dictionary representing a database row containing a - Timespanin this representation. Should have key(s) equal to the return value of- getFieldNames.
- namestr, optional
- Name for the logical column; a part of the name for multi-column representations. Defaults to - cls.NAME.
 
- mapping
- Returns:
- region
- Python representation of the region. 
 
 
 - abstract flatten(name: str | None) Iterator[ColumnElement]¶
- Return the actual column(s) that comprise this logical column. - Parameters:
- namestr, optional
- If provided, a name for the logical column that should be used to label the columns. If not provided, the columns’ native names will be used. 
 
- name
- Returns:
- columnsIterator[sqlalchemy.sql.ColumnElement]
- The true column or columns that back this object. 
 
- columns
 
 - abstract classmethod fromSelectable(selectable: FromClause, name: str | None = None) _S¶
- Construct representation of a column in the table or subquery. - Constructs an instance that represents a logical column (which may actually be backed by multiple columns) in the given table or subquery. - Parameters:
- selectablesqlalchemy.sql.FromClause
- SQLAlchemy object representing a table or subquery. 
- namestr, optional
- Name for the logical column; a part of the name for multi-column representations. Defaults to - cls.NAME.
 
- selectable
- Returns:
- representationTopologicalExtentDatabaseRepresentation
- Object representing a logical column. 
 
- representation
 
 - abstract classmethod getFieldNames(name: str | None = None) Tuple[str, ...]¶
- Return the actual field names used by this representation. - Parameters:
- namestr, optional
- Name for the logical column; a part of the name for multi-column representations. Defaults to - cls.NAME.
 
- name
- Returns:
- namestuple[str]
- Field name(s). Guaranteed to be the same as the names of the field specifications returned by - makeFieldSpecs.
 
- names
 
 - classmethod hasExclusionConstraint() bool¶
- Return - Trueif this representation supports exclusion constraints.
 - abstract isNull() ColumnElement¶
- Return expression that tests where region is - NULL.- Returns a SQLAlchemy expression that tests whether this region is logically - NULL.- Returns:
- isnullsqlalchemy.sql.ColumnElement
- A boolean SQLAlchemy expression object. 
 
- isnull
 
 - abstract classmethod makeFieldSpecs(nullable: bool, name: str | None = None, **kwargs: Any) Tuple[FieldSpec, ...]¶
- Make objects that reflect the fields that must be added to table. - Makes one or more - ddl.FieldSpecobjects that reflect the fields that must be added to a table for this representation.- Parameters:
- nullablebool
- If - True, the region is permitted to be logically- NULL(mapped to- Nonein Python), though the correspoding value(s) in the database are implementation-defined. Nullable region fields default to NULL, while others default to (-∞, ∞).
- namestr, optional
- Name for the logical column; a part of the name for multi-column representations. Defaults to - cls.NAME.
- **kwargs
- Keyword arguments are forwarded to the - ddl.FieldSpecconstructor for all fields; implementations only provide the- name,- dtype, and- defaultarguments themselves.
 
- nullable
- Returns:
- specstuple[ddl.FieldSpec]
- Field specification objects; length of the tuple is subclass-dependent, but is guaranteed to match the length of the return values of - getFieldNamesand- update.
 
- specs
 
 - abstract classmethod update(extent: _R | None, name: str | None = None, result: Dict[str, Any] | None = None) Dict[str, Any]¶
- Add a region to a dictionary. - This region represents a database row in this representation. - Parameters:
- extent
- An instance of the region type this class provides a database representation for, or - Nonefor- NULL.
- namestr, optional
- Name for the logical column; a part of the name for multi-column representations. Defaults to - cls.NAME.
- resultdict[str,Any], optional
- A dictionary representing a database row that fields should be added to, or - Noneto create and return a new one.
 
- Returns: