Repository navigation
fix(save_df): include keyword names in the cache key - #311
Merged
Merged
Conversation
The cache file name was built from keyword argument values only, joined without a separator, so get_series(id, startPeriod="2023") and get_series(id, endPeriod="2023") shared the same cached file. Fixes InseeFrLab#310 Signed-off-by: Guillaume Marty <279286709+LemonCondor@users.noreply.github.com>
Collaborator
|
Thanks for the fix, I'm trying to see whether @hadrilec can setup an environment so we can run the tests, will try to come back to you soon |
tfardet
approved these changes
Oct 14, 2026
tfardet
left a comment
Collaborator
There was a problem hiding this comment.
I ran the test locally and everything looks good, thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #310
save_dfbuilt the cache file name from keyword argument values only, joined without a separator, so different calls could share a cache file — e.g.get_series(id, endPeriod="2023-01")returned the data cached by an earlierget_series(id, startPeriod="2023-01").Change
name=valuefor keyword arguments, sorted by name (so keyword order doesn't create duplicate files), and parts are joined with a separator (\x1f) so positional boundaries can't collide (("AB", "C")vs("A", "BC")).Tests
tests/utils/test_save_df.py(offline, uses a temporary cache folder):startPeriod-like vsendPeriod-like keyword with the same value → distinct results (failed before)Also checked against the live API: after the fix, the example in #310 returns 397 rows (1990-01 .. 2023-01) as expected.
tests/utilspasses locally; black and flake8 pass with the project config.