DimensionRecordStorageManager¶
- class lsst.daf.butler.registry.interfaces.DimensionRecordStorageManager(*, universe: DimensionUniverse)¶
- Bases: - VersionedExtension- An interface for managing the dimension records in a - Registry.- DimensionRecordStorageManagerprimarily serves as a container and factory for- DimensionRecordStorageinstances, which each provide access to the records for a different- DimensionElement.- Parameters:
- universeDimensionUniverse
- Universe of all dimensions and dimension elements known to the - Registry.
 
- universe
 - Notes - In a multi-layer - Registry, many dimension elements will only have records in one layer (often the base layer). The union of the records across all layers forms the logical table for the full- Registry.- Methods Summary - Clear any in-memory caches held by nested - DimensionRecordStorageinstances.- Return extension version as defined by current implementation. - Return full name of the extension. - get(element)- Return an object that provides access to the records associated with the given element, if one exists in this layer. - initialize(db, context, *, universe)- Construct an instance of the manager. - loadDimensionGraph(key)- Retrieve a - DimensionGraphthat was previously saved in the database.- make_spatial_join_relation(element1, ...)- Create a relation that represents the spatial join between two dimension elements. - register(element)- Ensure that this layer can hold records for the given element, creating new tables as necessary. - saveDimensionGraph(graph)- Save a - DimensionGraphdefinition to the database, allowing it to be retrieved later via the returned key.- Methods Documentation - abstract clearCaches() None¶
- Clear any in-memory caches held by nested - DimensionRecordStorageinstances.- This is called by - Registrywhen transactions are rolled back, to avoid in-memory caches from ever containing records that are not present in persistent storage.
 - abstract classmethod currentVersion() VersionTuple | None¶
- Return extension version as defined by current implementation. - This method can return - Noneif an extension does not require its version to be saved or checked.- Returns:
- versionVersionTuple
- Current extension version or - None.
 
- version
 
 - classmethod extensionName() str¶
- Return full name of the extension. - This name should match the name defined in registry configuration. It is also stored in registry attributes. Default implementation returns full class name. - Returns:
- namestr
- Full extension name. 
 
- name
 
 - abstract get(element: DimensionElement | str) DimensionRecordStorage | None¶
- Return an object that provides access to the records associated with the given element, if one exists in this layer. - Parameters:
- elementDimensionElement
- Element for which records should be returned. 
 
- element
- Returns:
- recordsDimensionRecordStorageorNone
- The object representing the records for the given element in this layer, or - Noneif there are no records for that element in this layer.
 
- records
 - Notes - Dimension elements registered by another client of the same layer since the last call to - initializeor- refreshmay not be found.
 - abstract classmethod initialize(db: Database, context: StaticTablesContext, *, universe: DimensionUniverse) DimensionRecordStorageManager¶
- Construct an instance of the manager. - Parameters:
- dbDatabase
- Interface to the underlying database engine and namespace. 
- contextStaticTablesContext
- Context object obtained from - Database.declareStaticTables; used to declare any tables that should always be present in a layer implemented with this manager.
- universeDimensionUniverse
- Universe graph containing dimensions known to this - Registry.
 
- db
- Returns:
- managerDimensionRecordStorageManager
- An instance of a concrete - DimensionRecordStorageManagersubclass.
 
- manager
 
 - abstract loadDimensionGraph(key: int) DimensionGraph¶
- Retrieve a - DimensionGraphthat was previously saved in the database.- Parameters:
- keyint
- Integer used as the unique key for this - DimensionGraphin the database.
 
- key
- Returns:
- graphDimensionGraph
- Retrieved graph. 
 
- graph
- Raises:
- KeyError
- Raised if the given key cannot be found in the database. 
 
 
 - abstract make_spatial_join_relation(element1: str, element2: str, context: queries.SqlQueryContext, governor_constraints: Mapping[str, Set[str]]) tuple[Relation, bool]¶
- Create a relation that represents the spatial join between two dimension elements. - Parameters:
- element1str
- Name of one of the elements participating in the join. 
- element2str
- Name of the other element participating in the join. 
- contextqueries.SqlQueryContext
- Object that manages relation engines and database-side state (e.g. temporary tables) for the query. 
- governor_constraintsMapping[str,collections.abc.Set], optional
- Constraints imposed by other aspects of the query on governor dimensions. 
 
- element1
- Returns:
- relation``lsst.daf.relation.Relation`
- New relation that represents a spatial join between the two given elements. Guaranteed to have key columns for all required dimensions of both elements. 
- needs_refinementbool
- Whether the returned relation represents a conservative join that needs refinement via native-iteration predicate. 
 
 
 - abstract register(element: DimensionElement) DimensionRecordStorage¶
- Ensure that this layer can hold records for the given element, creating new tables as necessary. - Parameters:
- elementDimensionElement
- Element for which a table should created (as necessary) and an associated - DimensionRecordStoragereturned.
 
- element
- Returns:
- recordsDimensionRecordStorage
- The object representing the records for the given element in this layer. 
 
- records
- Raises:
- TransactionInterruption
- Raised if this operation is invoked within a - Database.transactioncontext.
 
 
 - abstract saveDimensionGraph(graph: DimensionGraph) int¶
- Save a - DimensionGraphdefinition to the database, allowing it to be retrieved later via the returned key.- Parameters:
- graphDimensionGraph
- Set of dimensions to save. 
 
- graph
- Returns:
- keyint
- Integer used as the unique key for this - DimensionGraphin the database.
 
- key
- Raises:
- TransactionInterruption
- Raised if this operation is invoked within a - Database.transactioncontext.