Repository navigation
usaspending-orm v0.5.1
usaspending-orm v0.5.1
This release focuses on improving reliability, data handling, and resiliency. Key changes include a critical fix to the lazy loading logic, robust fallback for cache failures, and more detailed query logging.
Highlights
- Improved Lazy Loading: Lazy-loaded attributes will now correctly fetch fresh data from the API if their current value is
Noneor the key is missing. This fixes a critical bug whereNonevalues were incorrectly treated as valid data, particularly affecting theRecipient.parentsproperty. - Robust Cache Fallback: The client is now more resilient to caching issues. If the cache fails, returns invalid data, or raises an exception, the client will automatically fall back to an uncached API request, ensuring your application continues to function.
- Centralized Model Validation: Model initialization is now more consistent and robust with a new centralized validation method. This improves error handling when creating
Agency,Award, andRecipientobjects from invalid data (e.g.,Noneor incorrect types).
Features & Improvements
- Enhanced Query Logging: Query logging is now significantly more detailed. At the
DEBUGlevel, logs include a full breakdown of the filters being applied to a query, making debugging much easier. At theINFOlevel, active filter keys are logged.
Bug Fixes
- Fixed a bug in
LazyRecordwhere aNonevalue for an attribute would prevent lazy loading from being triggered. The logic now correctly fetches data when a key is missing or its value isNone. - The
Recipient.parentsproperty now correctly uses the lazy loading mechanism to fetch parent data when it's not present in the initial object data.
Refactoring & Configuration Changes
- The
Recipient.alternate_namesproperty now always returns alist, defaulting to an empty list ([]) instead ofNoneif no names are present. - Sessions will now refresh after 250 calls to prevent IP throttling from the USASpending API. This is helpful when running extensive querying.
Full Changelog: v0.5.0...v0.5.1