Skip to content

Improve caching#157

Merged
jm-rivera merged 1 commit into
mainfrom
improve-stale-caching
Feb 13, 2026
Merged

Improve caching#157
jm-rivera merged 1 commit into
mainfrom
improve-stale-caching

Conversation

@jm-rivera

Copy link
Copy Markdown
Collaborator

This pull request addresses a bug in the memory cache logic that could return stale or incomplete results when a cached DataFrame did not contain all the columns requested by a subsequent query. The fix ensures that memory cache entries are only used if they include all requested columns, and introduces a projection-specific cache key to store and retrieve column-subset (projected) results separately. This prevents cache pollution and stale data issues for projected reads.

Caching and Query Logic Improvements:

  • Updated the memory cache logic in read methods to only return a cached DataFrame if it contains all requested columns, preventing incomplete results from being served. [1] [2]
  • Introduced a projection-specific cache key using the new generate_projection_hash function, allowing column-subset (projected) results to be cached and retrieved separately from full-table results. [1] [2]
  • Modified bulk cache reads to cache projected DataFrames under their own keys, avoiding pollution of the main filter-based cache and ensuring correct results for future queries with the same projection. [1] [2]

Documentation and Versioning:

  • Bumped the package version to 2.4.2 and updated the changelog to document the cache bug fix. [1] [2]

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 34.61538% with 17 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@3d8795a). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/oda_data/api/sources.py 22.72% 14 Missing and 3 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #157   +/-   ##
=======================================
  Coverage        ?   75.64%           
=======================================
  Files           ?       36           
  Lines           ?     2164           
  Branches        ?      198           
=======================================
  Hits            ?     1637           
  Misses          ?      490           
  Partials        ?       37           
Flag Coverage Δ
unittests 75.64% <34.61%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jm-rivera jm-rivera merged commit db948b3 into main Feb 13, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants