From a2252d8f9fdd6fc0f6fe7d2de7aa8209d300e640 Mon Sep 17 00:00:00 2001 From: Grigory Statsenko Date: Thu, 23 Nov 2023 16:09:14 +0100 Subject: [PATCH] Fix for compeng caches --- .../dl_core/data_processing/cache/utils.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/dl_core/dl_core/data_processing/cache/utils.py b/lib/dl_core/dl_core/data_processing/cache/utils.py index 70902ccdf..3cd6adff4 100644 --- a/lib/dl_core/dl_core/data_processing/cache/utils.py +++ b/lib/dl_core/dl_core/data_processing/cache/utils.py @@ -138,6 +138,20 @@ def get_cache_options( refresh_ttl_on_read=ttl_info.refresh_ttl_on_read, ) + def get_data_key( + self, + *, + query_res_info: QueryAndResultInfo, + from_info: Optional[PreparedFromInfo] = None, + base_key: LocalKeyRepresentation = LocalKeyRepresentation(), + ) -> Optional[LocalKeyRepresentation]: + # TODO: Remove after switching to new cache keys + compiled_query = self.get_query_str_for_cache( + query=query_res_info.query, + dialect=from_info.query_compiler.dialect, + ) + return base_key.extend(part_type="query", part_content=compiled_query) + @attr.s class SelectorCacheOptionsBuilder(DatasetOptionsBuilder): @@ -173,6 +187,8 @@ def make_data_select_cache_key( is_bleeding_edge_user: bool, base_key: LocalKeyRepresentation = LocalKeyRepresentation(), ) -> LocalKeyRepresentation: + # TODO: Remove after switching to new cache keys, + # but put the db_name + target_connection.get_cache_key_part() parts somewhere assert from_info.target_connection_ref is not None target_connection = self._us_entry_buffer.get_entry(from_info.target_connection_ref) assert isinstance(target_connection, ConnectionBase) @@ -201,6 +217,7 @@ def get_data_key( from_info: Optional[PreparedFromInfo] = None, base_key: LocalKeyRepresentation = LocalKeyRepresentation(), ) -> Optional[LocalKeyRepresentation]: + # TODO: Remove after switching to new cache keys compiled_query = self.get_query_str_for_cache( query=query_res_info.query, dialect=from_info.query_compiler.dialect,