ObsCoreTableManager¶
- class lsst.daf.butler.registry.interfaces.ObsCoreTableManager(*, registry_schema_version: VersionTuple | None = None)¶
- Bases: - VersionedExtension- An interface for populating ObsCore tables(s). - Parameters:
- registry_schema_versionVersionTupleorNone, optional
- Version of registry schema. 
 
- registry_schema_version
 - Methods Summary - add_datasets(refs)- Possibly add datasets to the obscore table. - associate(refs, collection)- Possibly add datasets to the obscore table. - clone(*, db, dimensions)- Make an independent copy of this manager instance bound to new instances of - Databaseand other managers.- Dump configuration in JSON format. - disassociate(refs, collection)- Possibly remove datasets from the obscore table. - initialize(db, context, *, universe, config, ...)- Construct an instance of the manager. - query([columns])- Run a SELECT query against obscore table and return result rows. - update_exposure_regions(instrument, region_data)- Update existing exposure records with spatial region data. - Methods Documentation - abstract add_datasets(refs: Iterable[DatasetRef]) int¶
- Possibly add datasets to the obscore table. - This method should be called when new datasets are added to a RUN collection. - Parameters:
- refsiterable[DatasetRef]
- Dataset refs to add. Dataset refs have to be completely expanded. If a record with the same dataset ID is already in obscore table, the dataset is ignored. 
 
- refs
- Returns:
- countint
- Actual number of records inserted into obscore table. 
 
- count
 - Notes - Dataset data types and collection names are checked against configured list of collections and dataset types, non-matching datasets are ignored and not added to the obscore table. - When configuration parameter - collection_typeis not “RUN”, this method should return immediately.- Note that there is no matching method to remove datasets from obscore table, we assume that removal happens via foreign key constraint to dataset table with “ON DELETE CASCADE” option. 
 - abstract associate(refs: Iterable[DatasetRef], collection: CollectionRecord) int¶
- Possibly add datasets to the obscore table. - This method should be called when existing datasets are associated with a TAGGED collection. - Parameters:
- refsiterable[DatasetRef]
- Dataset refs to add. Dataset refs have to be completely expanded. If a record with the same dataset ID is already in obscore table, the dataset is ignored. 
- collectionCollectionRecord
- Collection record for a TAGGED collection. 
 
- refs
- Returns:
- countint
- Actual number of records inserted into obscore table. 
 
- count
 - Notes - Dataset data types and collection names are checked against configured list of collections and dataset types, non-matching datasets are ignored and not added to the obscore table. - When configuration parameter - collection_typeis not “TAGGED”, this method should return immediately.
 - abstract clone(*, db: Database, dimensions: DimensionRecordStorageManager) ObsCoreTableManager¶
- Make an independent copy of this manager instance bound to new instances of - Databaseand other managers.- Parameters:
- dbDatabase
- New - Databaseobject to use when instantiating the manager.
- dimensionsDimensionRecordStorageManager
- New - DimensionRecordStorageManagerobject to use when instantiating the manager.
 
- db
- Returns:
- instanceObsCoreTableManager
- New manager instance with the same configuration as this instance, but bound to a new Database object. 
 
- instance
 
 - abstract config_json() str¶
- Dump configuration in JSON format. - Returns:
- jsonstr
- Configuration serialized in JSON format. 
 
- json
 
 - abstract disassociate(refs: Iterable[DatasetRef], collection: CollectionRecord) int¶
- Possibly remove datasets from the obscore table. - This method should be called when datasets are disassociated from a TAGGED collection. - Parameters:
- refsiterable[DatasetRef]
- Dataset refs to remove. Dataset refs have to be resolved. 
- collectionCollectionRecord
- Collection record for a TAGGED collection. 
 
- refs
- Returns:
- countint
- Actual number of records removed from obscore table. 
 
- count
 - Notes - Dataset data types and collection names are checked against configured list of collections and dataset types, non-matching datasets are ignored and not added to the obscore table. - When configuration parameter - collection_typeis not “TAGGED”, this method should return immediately.
 - abstract classmethod initialize(db: Database, context: StaticTablesContext, *, universe: DimensionUniverse, config: Mapping, datasets: type[DatasetRecordStorageManager], dimensions: DimensionRecordStorageManager, registry_schema_version: VersionTuple | None = None, column_type_info: ColumnTypeInfo) ObsCoreTableManager¶
- 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
- All dimensions known to the registry. 
- configdict[str,Any]
- Configuration of the obscore manager. 
- datasetstype
- Type of dataset manager. 
- dimensionsDimensionRecordStorageManager
- Manager for Registry dimensions. 
- registry_schema_versionVersionTupleorNone
- Schema version of this extension as defined in registry. 
- column_type_infoColumnTypeInfo
- Information about column types that can differ between data repositories and registry instances. 
 
- db
- Returns:
- managerObsCoreTableManager
- An instance of a concrete - ObsCoreTableManagersubclass.
 
- manager
 
 - abstract query(columns: Iterable[str | ColumnElement] | None = None, /, **kwargs: Any) Iterator[CursorResult]¶
- Run a SELECT query against obscore table and return result rows. - Parameters:
- columnsIterable[str]
- Columns to return from query. It is a sequence which can include column names or any other column elements (e.g. - sqlalchemy.sql.functions.countfunction).
- **kwargs
- Restriction on values of individual obscore columns. Key is the column name, value is the required value of the column. Multiple restrictions are ANDed together. 
 
- columns
- Returns:
- result_contextsqlalchemy.engine.CursorResult
- Context manager that returns the query result object when entered. These results are invalidated when the context is exited. 
 
- result_context
 
 - abstract update_exposure_regions(instrument: str, region_data: Iterable[tuple[int, int, Region]]) int¶
- Update existing exposure records with spatial region data. - Parameters:
- Returns:
- countint
- Actual number of records updated. 
 
- count
 - Notes - This method is needed to update obscore records for raw exposures which are ingested before their corresponding visits are defined. Exposure records added when visit is already defined will get their regions from their matching visits automatically.