diff --git a/python/lsst/daf/butler/registry/datasets/byDimensions/_manager.py b/python/lsst/daf/butler/registry/datasets/byDimensions/_manager.py index 251b4ab799..9236cc636f 100644 --- a/python/lsst/daf/butler/registry/datasets/byDimensions/_manager.py +++ b/python/lsst/daf/butler/registry/datasets/byDimensions/_manager.py @@ -696,7 +696,7 @@ def insert( def import_( self, - dataset_type_name: str, + dataset_type: DatasetType, run: RunRecord, data_ids: Mapping[DatasetId, DataCoordinate], ) -> list[DatasetRef]: @@ -705,8 +705,8 @@ def import_( # Just in case an empty mapping is provided we want to avoid # adding dataset type to summary tables. return [] - if (storage := self._find_storage(dataset_type_name)) is None: - raise MissingDatasetTypeError(f"Dataset type {dataset_type_name!r} has not been registered.") + if (storage := self._find_storage(dataset_type.name)) is None: + raise MissingDatasetTypeError(f"Dataset type {dataset_type.name!r} has not been registered.") # Current timestamp, type depends on schema version. if self._use_astropy_ingest_date: # Astropy `now()` precision should be the same as `now()` which @@ -751,7 +751,7 @@ def import_( ) refs = [ DatasetRef( - datasetType=storage.dataset_type, + datasetType=dataset_type, id=dataset_id, dataId=dataId, run=run.name, diff --git a/python/lsst/daf/butler/registry/interfaces/_datasets.py b/python/lsst/daf/butler/registry/interfaces/_datasets.py index 98767009db..2ee7d7b265 100644 --- a/python/lsst/daf/butler/registry/interfaces/_datasets.py +++ b/python/lsst/daf/butler/registry/interfaces/_datasets.py @@ -419,7 +419,7 @@ def insert( @abstractmethod def import_( self, - dataset_type_name: str, + dataset_type: DatasetType, run: RunRecord, data_ids: Mapping[DatasetId, DataCoordinate], ) -> list[DatasetRef]: @@ -427,8 +427,9 @@ def import_( Parameters ---------- - dataset_type_name : `str` - Name of the dataset type. + dataset_type : `DatasetType` + Type of dataset to import. Also used as the dataset type for + the returned refs. run : `RunRecord` The record object describing the `~CollectionType.RUN` collection these datasets will be associated with. diff --git a/python/lsst/daf/butler/registry/sql_registry.py b/python/lsst/daf/butler/registry/sql_registry.py index 96d930291a..88f6b85b07 100644 --- a/python/lsst/daf/butler/registry/sql_registry.py +++ b/python/lsst/daf/butler/registry/sql_registry.py @@ -1176,7 +1176,7 @@ def _importDatasets( data_ids = {dataset.id: dataset.dataId for dataset in datasets} try: - refs = list(self._managers.datasets.import_(datasetType.name, runRecord, data_ids)) + refs = list(self._managers.datasets.import_(datasetType, runRecord, data_ids)) if self._managers.obscore: self._managers.obscore.add_datasets(refs) except sqlalchemy.exc.IntegrityError as err: