diff --git a/lib/dl_api_lib/dl_api_lib/dataset/base_wrapper.py b/lib/dl_api_lib/dl_api_lib/dataset/base_wrapper.py index 6ba5610ce..72f4c6d3b 100644 --- a/lib/dl_api_lib/dl_api_lib/dataset/base_wrapper.py +++ b/lib/dl_api_lib/dl_api_lib/dataset/base_wrapper.py @@ -263,15 +263,14 @@ def get_backend_type(self) -> SourceBackendType: return self._capabilities.get_backend_type(role=self.resolve_role()) def _reload_sources(self) -> None: - self._has_sources = bool(self._ds.get_single_data_source_id()) # resolve database characteristics # never go to database from here --> only_cache=True - if self._has_sources: + if (source_id := self._ds.get_single_data_source_id()) is not None: + self._has_sources = True role = self.resolve_role() try: backend_type = self._capabilities.get_backend_type(role=role) dialect_name = resolve_dialect_name(backend_type=backend_type) - source_id = self._ds.get_single_data_source_id() dsrc = self._get_data_source_strict(source_id=source_id, role=role) db_info = dsrc.get_cached_db_info() db_version = db_info.version @@ -281,6 +280,8 @@ def _reload_sources(self) -> None: ) except ReferencedUSEntryNotFound: self.dialect = D.DUMMY + else: + self._has_sources = False if self._query_spec is not None: self.load_exbuilders()