ObsCoreTableManager¶
-
class
lsst.daf.butler.registry.interfaces.
ObsCoreTableManager
¶ Bases:
lsst.daf.butler.registry.interfaces.VersionedExtension
An interface for populating ObsCore tables(s).
Methods Summary
add_datasets
(refs)Possibly add datasets to the obscore table. associate
(refs, collection)Possibly add datasets to the obscore table. config_json
()Dump configuration in JSON format. currentVersion
()Return extension version as defined by current implementation. disassociate
(refs, collection)Possibly remove datasets from the obscore table. extensionName
()Return full name of the extension. initialize
(db, context, *, universe, config, …)Construct an instance of the manager. schemaDigest
()Return digest for schema piece managed by this extension. Methods Documentation
-
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: - refs :
iterable
[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.
Returns: - count :
int
Actual number of records inserted into obscore table.
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_type
is 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.
- refs :
-
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: - refs :
iterable
[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.
- collection :
CollectionRecord
Collection record for a TAGGED collection.
Returns: - count :
int
Actual number of records inserted into obscore table.
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_type
is not “TAGGED”, this method should return immediately.- refs :
-
config_json
() → str¶ Dump configuration in JSON format.
Returns: - json :
str
Configuration serialized in JSON format.
- json :
-
classmethod
currentVersion
() → Optional[lsst.daf.butler.registry.interfaces._versioning.VersionTuple, None]¶ Return extension version as defined by current implementation.
This method can return
None
if an extension does not require its version to be saved or checked.Returns: - version :
VersionTuple
Current extension version or
None
.
- version :
-
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: - refs :
iterable
[DatasetRef
] Dataset refs to remove. Dataset refs have to be resolved.
- collection :
CollectionRecord
Collection record for a TAGGED collection.
Returns: - count :
int
Actual number of records removed from obscore table.
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_type
is not “TAGGED”, this method should return immediately.- refs :
-
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: - name :
str
Full extension name.
- name :
-
classmethod
initialize
(db: Database, context: StaticTablesContext, *, universe: DimensionUniverse, config: Mapping, datasets: Type[DatasetRecordStorageManager], dimensions: DimensionRecordStorageManager) → ObsCoreTableManager¶ Construct an instance of the manager.
Parameters: - db :
Database
Interface to the underlying database engine and namespace.
- context :
StaticTablesContext
Context object obtained from
Database.declareStaticTables
; used to declare any tables that should always be present in a layer implemented with this manager.- universe :
DimensionUniverse
All dimensions known to the registry.
- config :
dict
[str
,Any
] Configuration of the obscore manager.
- datasets :
type
Type of dataset manager.
- dimensions: `DimensionRecordStorageManager`
Manager for Registry dimensions.
Returns: - manager :
ObsCoreTableManager
An instance of a concrete
ObsCoreTableManager
subclass.
- db :
-
schemaDigest
() → Optional[str, None]¶ Return digest for schema piece managed by this extension.
Returns: Notes
There is no exact definition of digest format, any string should work. The only requirement for string contents is that it has to remain stable over time if schema does not change but it should produce different string for any change in the schema. In many cases default implementation in
_defaultSchemaDigest
can be used as a reasonable choice.
-