DatasetRecordStorageManager¶
- class lsst.daf.butler.registry.interfaces.DatasetRecordStorageManager(*, registry_schema_version: VersionTuple | None = None)¶
- Bases: - VersionedExtension- An interface that manages the tables that describe datasets. - DatasetRecordStorageManagerprimarily serves as a container and factory for- DatasetRecordStorageinstances, which each provide access to the records for a different- DatasetType.- Methods Summary - addDatasetForeignKey(tableSpec, *[, name, ...])- Add a foreign key (field and constraint) referencing the dataset table. - checkCompatibility(registry_schema_version, ...)- Check that schema version defined in registry is compatible with current implementation. - checkNewSchemaVersion(schema_version)- Verify that requested schema version can be created by an extension. - Return schema version(s) supported by this extension class. - Return full name of the extension. - find(name)- Return an object that provides access to the records associated with the given - DatasetTypename, if one exists.- getCollectionSummary(collection)- Return a summary for the given collection. - getDatasetRef(id)- Return a - DatasetReffor the given dataset primary key value.- Return type used for columns storing dataset IDs. - initialize(db, context, *, collections, ...)- Construct an instance of the manager. - Return schema version for newly created registry. - refresh()- Ensure all other operations on this manager are aware of any dataset types that may have been registered by other clients since it was initialized or last refreshed. - register(datasetType)- Ensure that this - Registrycan hold records for the given- DatasetType, creating new tables as necessary.- remove(name)- Remove the dataset type. - resolve_wildcard(expression[, components, ...])- Resolve a dataset type wildcard expression. - supportsIdGenerationMode(mode)- Test whether the given dataset ID generation mode is supported by - insert.- Methods Documentation - abstract classmethod addDatasetForeignKey(tableSpec: TableSpec, *, name: str = 'dataset', constraint: bool = True, onDelete: str | None = None, **kwargs: Any) FieldSpec¶
- Add a foreign key (field and constraint) referencing the dataset table. - Parameters:
- tableSpecddl.TableSpec
- Specification for the table that should reference the dataset table. Will be modified in place. 
- name: `str`, optional
- A name to use for the prefix of the new field; the full name is - {name}_id.
- onDelete: `str`, optional
- One of “CASCADE” or “SET NULL”, indicating what should happen to the referencing row if the collection row is deleted. - Noneindicates that this should be an integrity error.
- constraint: `bool`, optional
- If - False(- Trueis default), add a field that can be joined to the dataset primary key, but do not add a foreign key constraint.
- **kwargs
- Additional keyword arguments are forwarded to the - ddl.FieldSpecconstructor (only the- nameand- dtypearguments are otherwise provided).
 
- tableSpec
- Returns:
- idSpecddl.FieldSpec
- Specification for the ID field. 
 
- idSpec
 
 - classmethod checkCompatibility(registry_schema_version: VersionTuple, update: bool) None¶
- Check that schema version defined in registry is compatible with current implementation. - Parameters:
- registry_schema_versionVersionTuple
- Schema version that exists in registry or defined in a configuration for a registry to be created. 
- updatebool
- If True then read-write access is expected. 
 
- registry_schema_version
- Raises:
- IncompatibleVersionError
- Raised if schema version is not supported by implementation. 
 
 - Notes - Default implementation uses - VersionTuple.checkCompatibilityon the versions returned from- currentVersionsmethod. Subclasses that support different compatibility model will overwrite this method.
 - classmethod checkNewSchemaVersion(schema_version: VersionTuple) None¶
- Verify that requested schema version can be created by an extension. - Parameters:
- schema_versionVersionTuple
- Schema version that this extension is asked to create. 
 
- schema_version
 - Notes - This method may be used only occasionally when a specific schema version is given in a regisitry config file. This can be used with an extension that supports multiple schem versions to make it create new schema with a non-default version number. Default implementation compares requested version with one of the version returned from - currentVersions.
 - abstract classmethod currentVersions() list[lsst.daf.butler.registry.interfaces._versioning.VersionTuple]¶
- Return schema version(s) supported by this extension class. - Returns:
- versionlist[VersionTuple]
- Schema versions for this extension. Empty list is returned if an extension does not require its version to be saved or checked. 
 
- 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 find(name: str) DatasetRecordStorage | None¶
- Return an object that provides access to the records associated with the given - DatasetTypename, if one exists.- Parameters:
- namestr
- Name of the dataset type. 
 
- name
- Returns:
- recordsDatasetRecordStorageorNone
- The object representing the records for the given dataset type, or - Noneif there are no records for that dataset type.
 
- records
 - Notes - Dataset types registered by another client of the same repository since the last call to - initializeor- refreshmay not be found.
 - abstract getCollectionSummary(collection: CollectionRecord) CollectionSummary¶
- Return a summary for the given collection. - Parameters:
- collectionCollectionRecord
- Record describing the collection for which a summary is to be retrieved. 
 
- collection
- Returns:
- summaryCollectionSummary
- Summary of the dataset types and governor dimension values in this collection. 
 
- summary
 
 - abstract getDatasetRef(id: UUID) DatasetRef | None¶
- Return a - DatasetReffor the given dataset primary key value.
 - abstract classmethod getIdColumnType() type¶
- Return type used for columns storing dataset IDs. - This type is used for columns storing - DatasetRef.idvalues, usually a- typesubclass provided by SQLAlchemy.- Returns:
- dtypetype
- Type used for dataset identification in database. 
 
- dtype
 
 - abstract classmethod initialize(db: Database, context: StaticTablesContext, *, collections: CollectionManager, dimensions: DimensionRecordStorageManager, registry_schema_version: VersionTuple | None = None) DatasetRecordStorageManager¶
- 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.
- collections: `CollectionManager`
- Manager object for the collections in this - Registry.
- dimensionsDimensionRecordStorageManager
- Manager object for the dimensions in this - Registry.
- registry_schema_versionVersionTupleorNone
- Schema version of this extension as defined in registry. 
 
- db
- Returns:
- managerDatasetRecordStorageManager
- An instance of a concrete - DatasetRecordStorageManagersubclass.
 
- manager
 
 - newSchemaVersion() VersionTuple | None¶
- Return schema version for newly created registry. - Returns:
- versionVersionTupleorNone
- Schema version created by this extension. - Noneis returned if an extension does not require its version to be saved or checked.
 
- version
 - Notes - Default implementation only forks for extensions that support single schema version and it returns version obtained from - currentVersions. If- currentVersionsreturns multiple version then default implementation will raise an exception and the method has to be reimplemented by a subclass.
 - abstract refresh() None¶
- Ensure all other operations on this manager are aware of any dataset types that may have been registered by other clients since it was initialized or last refreshed. 
 - abstract register(datasetType: DatasetType) tuple[lsst.daf.butler.registry.interfaces._datasets.DatasetRecordStorage, bool]¶
- Ensure that this - Registrycan hold records for the given- DatasetType, creating new tables as necessary.- Parameters:
- datasetTypeDatasetType
- Dataset type for which a table should created (as necessary) and an associated - DatasetRecordStoragereturned.
 
- datasetType
- Returns:
- recordsDatasetRecordStorage
- The object representing the records for the given dataset type. 
- insertedbool
- Trueif the dataset type did not exist in the registry before.
 
- records
 - Notes - This operation may not be invoked within a - Database.transactioncontext.
 - abstract remove(name: str) None¶
- Remove the dataset type. - Parameters:
- namestr
- Name of the dataset type. 
 
- name
 
 - abstract resolve_wildcard(expression: Any, components: bool | None = None, missing: list[str] | None = None, explicit_only: bool = False, components_deprecated: bool = True) dict[lsst.daf.butler.core.datasets.type.DatasetType, list[str | None]]¶
- Resolve a dataset type wildcard expression. - Parameters:
- expression
- Expression to resolve. Will be passed to - DatasetTypeWildcard.from_expression.
- componentsbool, optional
- If - True, apply all expression patterns to component dataset type names as well. If- False, never apply patterns to components. If- None(default), apply patterns to components only if their parent datasets were not matched by the expression. Fully-specified component datasets (- stror- DatasetTypeinstances) are always included.
- missinglistofstr, optional
- String dataset type names that were explicitly given (i.e. not regular expression patterns) but not found will be appended to this list, if it is provided. 
- explicit_onlybool, optional
- If - True, require explicit- DatasetTypeinstances or- strnames, with- re.Patterninstances deprecated and- ...prohibited.
- components_deprecatedbool, optional
- If - True, this is a context in which component dataset support is deprecated. This will result in a deprecation warning when- components=Trueor- components=Noneand a component dataset is matched. In the future this will become an error.
 
- Returns:
 
 - abstract classmethod supportsIdGenerationMode(mode: DatasetIdGenEnum) bool¶
- Test whether the given dataset ID generation mode is supported by - insert.- Parameters:
- modeDatasetIdGenEnum
- Enum value for the mode to test. 
 
- mode
- Returns:
- supportedbool
- Whether the given mode is supported. 
 
- supported