DatabaseTimespanRepresentation¶
- 
class lsst.daf.butler.DatabaseTimespanRepresentation¶
- Bases: - abc.ABC- An interface that encapsulates how timespans are represented in a database engine. - Most of this class’s interface is comprised of classmethods. Instances can be constructed via the - fromSelectablemethod as a way to include timespan overlap operations in query JOIN or WHERE clauses.- Attributes Summary - NAME- Base name for all timespan fields in the database ( - str).- Methods Summary - extract(mapping, Any])- Extract a - Timespaninstance from a dictionary that represents a database row in this representation.- fromSelectable(selectable)- Construct an instance of this class that proxies the columns of this representation in a table or SELECT query. - getFieldNames()- Return the actual field names used by this representation. - hasExclusionConstraint()- Return - Trueif this representation supports exclusion constraints.- isNull()- Return a SQLAlchemy expression that tests whether this timespan is logically - NULL.- makeFieldSpecs(nullable, **kwargs)- Make one or more - ddl.FieldSpecobjects that reflect the fields that must be added to a table for this representation.- overlaps(other, S])- Return a SQLAlchemy expression representing an overlap operation on timespans. - update(timespan, *, result, Any]] = None)- Add a - Timespanto a dictionary that represents a database row in this representation.- Attributes Documentation - 
NAME= 'timespan'¶
- Base name for all timespan fields in the database ( - str).- Actual field names may be derived from this, rather than exactly this. 
 - Methods Documentation - 
classmethod extract(mapping: Mapping[str, Any]) → Optional[lsst.daf.butler.core.timespan.Timespan]¶
- Extract a - Timespaninstance from a dictionary that represents a database row in this representation.- Parameters: - mapping : Mapping[str,Any]
- A dictionary representing a database row containing a - Timespanin this representation. Should have key(s) equal to the return value of- getFieldNames.
 - Returns: 
- mapping : 
 - 
classmethod fromSelectable(selectable: sqlalchemy.sql.selectable.FromClause) → S¶
- Construct an instance of this class that proxies the columns of this representation in a table or SELECT query. - Parameters: - selectable : sqlalchemy.sql.FromClause
- SQLAlchemy object representing a table or SELECT query that has columns in this representation. 
 - Returns: - instance : DatabaseTimespanRepresentation
- An instance of this representation subclass. 
 
- selectable : 
 - 
classmethod getFieldNames() → Tuple[str, ...]¶
- Return the actual field names used by this representation. - Returns: - names : tuple[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.- Returns: 
 - 
isNull() → sqlalchemy.sql.elements.ColumnElement¶
- Return a SQLAlchemy expression that tests whether this timespan is logically - NULL.- Returns: - isnull : sqlalchemy.sql.ColumnElement
- A boolean SQLAlchemy expression object. 
 
- isnull : 
 - 
classmethod makeFieldSpecs(nullable: bool, **kwargs) → Tuple[lsst.daf.butler.core.ddl.FieldSpec, ...]¶
- Make one or more - ddl.FieldSpecobjects that reflect the fields that must be added to a table for this representation.- Parameters: - nullable : bool
- If - True, the timespan is permitted to be logically- NULL(mapped to- Nonein Python), though the correspoding value(s) in the database are implementation-defined. Nullable timespan fields default to NULL, while others default to (-∞, ∞).
- **kwargs
- Keyword arguments are forwarded to the - ddl.FieldSpecconstructor for all fields; implementations only provide the- name,- dtype, and- defaultarguments themselves.
 - Returns: - specs : tuple[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.
 
- nullable : 
 - 
overlaps(other: Union[lsst.daf.butler.core.timespan.Timespan, S]) → sqlalchemy.sql.elements.ColumnElement¶
- Return a SQLAlchemy expression representing an overlap operation on timespans. - Parameters: - other : TimespanorDatabaseTimespanRepresentation
- The timespan to overlap - selfwith; either a Python- Timespanliteral or an instance of the same- DatabaseTimespanRepresentationas- self, representing a timespan in some other table or query within the same database.
 - Returns: - overlap : sqlalchemy.sql.ColumnElement
- A boolean SQLAlchemy expression object. 
 
- other : 
 
-