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

Can only fetch first run id from cache using SQLiteMetadataStore object #1204

Closed
elutins opened this issue Oct 24, 2024 · 2 comments
Closed
Labels
bug Something isn't working caching

Comments

@elutins
Copy link

elutins commented Oct 24, 2024

Cache only returns the first run_id that populated the cache when calling get_run_ids() on a hamilton.caching.stores.sqlite.SQLiteMetadataStore object

Current behavior

  • When calling get_run_ids() on a hamilton.caching.stores.sqlite.SQLiteMetadataStore class object, only the first run_id that populated the cache is returned rather than all run_ids of the cache.

Stack Traces

Believe this is caused by this line here in hamilton/caching/stores/sqlite.py in which the return result object is being indexed to the first item only

Steps to replicate behavior

  1. instantiate a driver object using with_cache()
driver = (
    hamilton.driver.Builder()
    .with_config()
    .with_modules({some_module})
    .with_cache()
    .build()
)
  1. execute the driver driver.execute(final_vars=[some_var], inputs={some_input})
  2. execute the driver again grabbing a different final_var: driver.execute(final_vars=[some_other_var], inputs={some_input})
  3. run hamilton.caching.stores.sqlite.SQLiteMetadataStore(".hamilton_cache").get_run_ids() to get the run_ids that populated cache
    • the expected/wanted behavior is that this command would return all run_ids - not just the first

Library & System Information

  • Using hamilton version 1.80.0 & python 3.12.7

Expected behavior

  • When calling get_run_ids() on a hamilton.caching.stores.sqlite.SQLiteMetadataStore class object, I'd expect a full list of run ids that have populated the cache to be returned rather than just the first run.

Additional context

Add any other context about the problem here.

@elutins elutins added the triage label for issues that need to be triaged. label Oct 24, 2024
@skrawcz
Copy link
Collaborator

skrawcz commented Oct 24, 2024

@elutins thanks for flagging. We'll get a fix out today.

@zilto zilto added bug Something isn't working caching and removed triage label for issues that need to be triaged. labels Oct 24, 2024
@skrawcz
Copy link
Collaborator

skrawcz commented Oct 24, 2024

@elutins this has been fixed in sf-hamilton==1.81.2. Thanks for raising! (otherwise please re-open if that's not the case).

@skrawcz skrawcz closed this as completed Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working caching
Projects
None yet
Development

No branches or pull requests

3 participants