Skip to content

Commit

Permalink
Fix for compeng caches
Browse files Browse the repository at this point in the history
  • Loading branch information
altvod committed Nov 23, 2023
1 parent 9a97256 commit a2252d8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/dl_core/dl_core/data_processing/cache/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a2252d8

Please sign in to comment.