DatabaseDimensionOverlapStorage¶
-
class
lsst.daf.butler.registry.interfaces.
DatabaseDimensionOverlapStorage
¶ Bases:
abc.ABC
A base class for objects that manage overlaps between a pair of database-backed dimensions.
Attributes Summary
elements
The pair of elements whose overlaps this object manages. Methods Summary
clearCaches
()Clear any cached state about which overlaps have been materialized. digestTables
()Return tables used for schema digest. initialize
(db, elementStorage, …)Construct an instance of this class using a standardized interface. make_relation
(context, governor_constraints, …)Return a lsst.daf.relation.Relation
that represents the join table.Attributes Documentation
-
elements
¶ The pair of elements whose overlaps this object manages.
The order of elements is the same as their ordering within the
DimensionUniverse
.
Methods Documentation
-
clearCaches
() → None¶ Clear any cached state about which overlaps have been materialized.
-
digestTables
() → collections.abc.Iterable[sqlalchemy.sql.schema.Table]¶ Return tables used for schema digest.
Returns: - tables :
Iterable
[sqlalchemy.schema.Table
] Possibly empty set of tables for schema digest calculations.
- tables :
-
classmethod
initialize
(db: Database, elementStorage: tuple[DatabaseDimensionRecordStorage, DatabaseDimensionRecordStorage], governorStorage: tuple[GovernorDimensionRecordStorage, GovernorDimensionRecordStorage], context: StaticTablesContext | None = None) → DatabaseDimensionOverlapStorage¶ Construct an instance of this class using a standardized interface.
Parameters: - db :
Database
Interface to the underlying database engine and namespace.
- elementStorage :
tuple
[DatabaseDimensionRecordStorage
] Storage objects for the elements this object will related.
- governorStorage :
tuple
[GovernorDimensionRecordStorage
] Storage objects for the governor dimensions of the elements this object will related.
- context :
StaticTablesContext
, optional If provided, an object to use to create any new tables. If not provided,
db.ensureTableExists
should be used instead.
Returns: - storage :
DatabaseDimensionOverlapStorage
A new
DatabaseDimensionOverlapStorage
subclass instance.
- db :
-
make_relation
(context: queries.SqlQueryContext, governor_constraints: Mapping[str, Set[str]]) → Relation | None¶ Return a
lsst.daf.relation.Relation
that represents the join table.High-level code should generally call
DimensionRecordStorageManager.make_spatial_join_relation
(which delegates to this) instead of calling this method directly.Parameters: - context :
queries.SqlQueryContext
Object that manages relation engines and database-side state (e.g. temporary tables) for the query.
- governor_constraints :
Mapping
[str
,Set
], optional Constraints imposed by other aspects of the query on governor dimensions; collections inconsistent with these constraints will be skipped.
Returns: - relation :
lsst.daf.relation.Relation
orNone
Join relation. Should be
None
when no direct overlaps for this combination are stored; higher-level code is responsible for working out alternative approaches involving multiple joins.
- context :
-