Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for compeng caches #119

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading