WIP: Add support for values to query#389
Open
gregorjerse wants to merge 1 commit intogenialis:masterfrom
Open
Conversation
There was a problem hiding this comment.
Pull Request Overview
A work-in-progress PR to add support for querying specific fields from resources.
- Extracts logic for fetching data into a new _fetch_data method.
- Adds a new values method to support field-specific queries and reduce data transfer.
- Adjusts the _fetch method to use _fetch_data and update caching accordingly.
Comments suppressed due to low confidence (2)
src/resdk/query.py:250
- Ensure that 'count' is always initialized in _fetch_data. If items is neither a dict with 'results' nor a list when self._limit is not None, 'count' could remain undefined. Consider initializing 'count' with a default value before the conditions.
if isinstance(items, dict) and "results" in items:
src/resdk/query.py:233
- [nitpick] The introduction of _fetch_data alongside _fetch may be slightly confusing. Consider renaming _fetch_data to something that clearly differentiates its purpose from _fetch, for example, _retrieve_data.
def _fetch_data(self):
Contributor
JureZmrzlikar
left a comment
There was a problem hiding this comment.
I like the idea. A new method on the Query makes it more explicit that you are not receiving the resource objects, but just a dict of requested values. In this regard it seems better API choice than using fields=[...] argument in .e.g. filter() method. Let's keep this going with replacing the occurrence of ResolweQuery.filter(fields=[..]) where appropriate.
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.
Just a suggestion.