diff --git a/kedro/io/data_catalog.py b/kedro/io/data_catalog.py index b21f90a8cf..40d079e6ac 100644 --- a/kedro/io/data_catalog.py +++ b/kedro/io/data_catalog.py @@ -386,6 +386,14 @@ def _get_dataset( self._load_versions.get(data_set_name), self._save_version, ) + if self._specificity(matched_pattern) == 0: + self._logger.warning( + "Config from the dataset factory pattern '%s' in the catalog will be used to " + "override the default MemoryDataset creation for the dataset '%s'", + matched_pattern, + data_set_name, + ) + self.add(data_set_name, data_set) if data_set_name not in self._data_sets: error_msg = f"Dataset '{data_set_name}' not found in the catalog" diff --git a/tests/io/test_data_catalog.py b/tests/io/test_data_catalog.py index 6752eeac04..74858702bf 100644 --- a/tests/io/test_data_catalog.py +++ b/tests/io/test_data_catalog.py @@ -818,11 +818,18 @@ def test_sorting_order_patterns(self, config_with_dataset_factories_only_pattern ] assert list(catalog._dataset_patterns.keys()) == sorted_keys_expected - def test_default_dataset(self, config_with_dataset_factories_with_default): + def test_default_dataset(self, config_with_dataset_factories_with_default, caplog): """Check that default dataset is used when no other pattern matches""" catalog = DataCatalog.from_config(**config_with_dataset_factories_with_default) assert "jet@planes" not in catalog._data_sets jet_dataset = catalog._get_dataset("jet@planes") + log_record = caplog.records[0] + assert log_record.levelname == "WARNING" + assert ( + "Config from the dataset factory pattern '{default_dataset}' " + "in the catalog will be used to override the default " + "MemoryDataset creation for the dataset 'jet@planes'" in log_record.message + ) assert isinstance(jet_dataset, CSVDataSet) def test_unmatched_key_error_when_parsing_config(