diff --git a/python/lsst/daf/butler/core/datastore.py b/python/lsst/daf/butler/core/datastore.py index 74bae60b7f..9f89d300ff 100644 --- a/python/lsst/daf/butler/core/datastore.py +++ b/python/lsst/daf/butler/core/datastore.py @@ -30,12 +30,12 @@ from __future__ import annotations __all__ = ( - "DatastoreConfig", + "DatasetRefURIs", "Datastore", + "DatastoreConfig", + "DatastoreOpaqueTable", "DatastoreValidationError", - "DatasetRefURIs", "NullDatastore", - "OpaqueTableDefinition", ) import contextlib @@ -95,7 +95,7 @@ class Event: @dataclasses.dataclass(frozen=True) -class OpaqueTableDefinition: +class DatastoreOpaqueTable: """Definition of the opaque table which stores datastore records. Table definition contains `.ddl.TableSpec` for a table and a class @@ -1262,7 +1262,7 @@ def set_retrieve_dataset_type_method(self, method: Callable[[str], DatasetType | pass @abstractmethod - def opaque_table_definitions(self) -> Mapping[str, OpaqueTableDefinition]: + def opaque_table_definitions(self) -> Mapping[str, DatastoreOpaqueTable]: """Make definitions of the opaque tables used by this Datastore. Returns @@ -1396,5 +1396,5 @@ def export_records( ) -> Mapping[str, DatastoreRecordData]: raise NotImplementedError("This is a no-op datastore that can not access a real datastore") - def opaque_table_definitions(self) -> Mapping[str, OpaqueTableDefinition]: + def opaque_table_definitions(self) -> Mapping[str, DatastoreOpaqueTable]: return {} diff --git a/python/lsst/daf/butler/datastores/chainedDatastore.py b/python/lsst/daf/butler/datastores/chainedDatastore.py index 04237b3f9a..0f9e9465ed 100644 --- a/python/lsst/daf/butler/datastores/chainedDatastore.py +++ b/python/lsst/daf/butler/datastores/chainedDatastore.py @@ -45,10 +45,10 @@ DatasetTypeNotSupportedError, Datastore, DatastoreConfig, + DatastoreOpaqueTable, DatastoreRecordData, DatastoreValidationError, FileDataset, - OpaqueTableDefinition, ) from lsst.resources import ResourcePath from lsst.utils import doImportType @@ -1181,9 +1181,9 @@ def transfer_from( return all_accepted, remaining_refs - def opaque_table_definitions(self) -> Mapping[str, OpaqueTableDefinition]: + def opaque_table_definitions(self) -> Mapping[str, DatastoreOpaqueTable]: # Docstring inherited from the base class. - tables: dict[str, OpaqueTableDefinition] = {} + tables: dict[str, DatastoreOpaqueTable] = {} for datastore in self.datastores: tables.update(datastore.opaque_table_definitions()) return tables diff --git a/python/lsst/daf/butler/datastores/fileDatastore.py b/python/lsst/daf/butler/datastores/fileDatastore.py index c286c41f6a..2164b5c502 100644 --- a/python/lsst/daf/butler/datastores/fileDatastore.py +++ b/python/lsst/daf/butler/datastores/fileDatastore.py @@ -51,6 +51,7 @@ DatastoreCacheManager, DatastoreConfig, DatastoreDisabledCacheManager, + DatastoreOpaqueTable, DatastoreRecordData, DatastoreValidationError, FileDataset, @@ -61,7 +62,6 @@ FormatterFactory, Location, LocationFactory, - OpaqueTableDefinition, Progress, StorageClass, StoredDatastoreItemInfo, @@ -3087,6 +3087,6 @@ def _cast_storage_class(self, ref: DatasetRef) -> DatasetRef: ref = ref.overrideStorageClass(dataset_type.storageClass) return ref - def opaque_table_definitions(self) -> Mapping[str, OpaqueTableDefinition]: + def opaque_table_definitions(self) -> Mapping[str, DatastoreOpaqueTable]: # Docstring inherited from the base class. - return {self._opaque_table_name: OpaqueTableDefinition(self.makeTableSpec(ddl.GUID), StoredFileInfo)} + return {self._opaque_table_name: DatastoreOpaqueTable(self.makeTableSpec(ddl.GUID), StoredFileInfo)} diff --git a/python/lsst/daf/butler/datastores/inMemoryDatastore.py b/python/lsst/daf/butler/datastores/inMemoryDatastore.py index 24dbba33c6..7e7cd811a1 100644 --- a/python/lsst/daf/butler/datastores/inMemoryDatastore.py +++ b/python/lsst/daf/butler/datastores/inMemoryDatastore.py @@ -54,7 +54,7 @@ from .genericDatastore import GenericBaseDatastore if TYPE_CHECKING: - from lsst.daf.butler import Config, DatasetType, LookupKey, OpaqueTableDefinition + from lsst.daf.butler import Config, DatasetType, DatastoreOpaqueTable, LookupKey from lsst.daf.butler.registry.interfaces import DatasetIdRef, DatastoreRegistryBridgeManager log = logging.getLogger(__name__) @@ -675,6 +675,6 @@ def export_records(self, refs: Iterable[DatasetIdRef]) -> Mapping[str, Datastore # In-memory Datastore records cannot be exported or imported return {} - def opaque_table_definitions(self) -> Mapping[str, OpaqueTableDefinition]: + def opaque_table_definitions(self) -> Mapping[str, DatastoreOpaqueTable]: # Docstring inherited from the base class. return {} diff --git a/python/lsst/daf/butler/registries/remote.py b/python/lsst/daf/butler/registries/remote.py index a207d6d586..6841eb4bb6 100644 --- a/python/lsst/daf/butler/registries/remote.py +++ b/python/lsst/daf/butler/registries/remote.py @@ -74,7 +74,7 @@ if TYPE_CHECKING: from .._butlerConfig import ButlerConfig - from ..core import OpaqueTableDefinition + from ..core import DatastoreOpaqueTable from ..registry._registry import CollectionArgType from ..registry.interfaces import CollectionRecord, DatastoreRegistryBridgeManager @@ -681,7 +681,7 @@ def store_datastore_records(self, refs: Mapping[str, DatasetRef]) -> None: # Docstring inherited from base class. return - def make_datastore_tables(self, tables: Mapping[str, OpaqueTableDefinition]) -> None: + def make_datastore_tables(self, tables: Mapping[str, DatastoreOpaqueTable]) -> None: # Docstring inherited from base class. return diff --git a/python/lsst/daf/butler/registries/sql.py b/python/lsst/daf/butler/registries/sql.py index cd98bf0d34..1cec58ba20 100644 --- a/python/lsst/daf/butler/registries/sql.py +++ b/python/lsst/daf/butler/registries/sql.py @@ -90,7 +90,7 @@ if TYPE_CHECKING: from .._butlerConfig import ButlerConfig - from ..core import OpaqueTableDefinition, StoredDatastoreItemInfo + from ..core import DatastoreOpaqueTable, StoredDatastoreItemInfo from ..registry._registry import CollectionArgType from ..registry.interfaces import ( CollectionRecord, @@ -1374,7 +1374,7 @@ def store_datastore_records(self, refs: Mapping[str, DatasetRef]) -> None: assert opaque_table is not None, f"Unexpected opaque table name {table_name}" opaque_table.insert(*(record.to_record(dataset_id=ref.id) for record in records)) - def make_datastore_tables(self, tables: Mapping[str, OpaqueTableDefinition]) -> None: + def make_datastore_tables(self, tables: Mapping[str, DatastoreOpaqueTable]) -> None: # Docstring inherited from base class. datastore_record_classes = {} diff --git a/python/lsst/daf/butler/registry/_butler_registry.py b/python/lsst/daf/butler/registry/_butler_registry.py index 50e569c31b..5989e3d508 100644 --- a/python/lsst/daf/butler/registry/_butler_registry.py +++ b/python/lsst/daf/butler/registry/_butler_registry.py @@ -42,7 +42,7 @@ if TYPE_CHECKING: from .._butlerConfig import ButlerConfig - from ..core import OpaqueTableDefinition + from ..core import DatastoreOpaqueTable from .interfaces import CollectionRecord, DatastoreRegistryBridgeManager @@ -253,7 +253,7 @@ def store_datastore_records(self, refs: Mapping[str, DatasetRef]) -> None: raise NotImplementedError() @abstractmethod - def make_datastore_tables(self, tables: Mapping[str, OpaqueTableDefinition]) -> None: + def make_datastore_tables(self, tables: Mapping[str, DatastoreOpaqueTable]) -> None: """Create opaque tables used by datastores. Parameters