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

add support for query ordering param (closes #114) #116

Merged
merged 1 commit into from
Dec 5, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions solvebio/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ def __init__(
genome_build=None,
filters=None,
fields=None,
ordering=None,
limit=float('inf'),
page_size=DEFAULT_PAGE_SIZE,
result_class=dict,
Expand All @@ -235,6 +236,7 @@ def __init__(
- `genome_build`: The genome build to use for the query.
- `result_class` (optional): Class of object returned by query.
- `fields` (optional): List of specific fields to retrieve.
- `ordering` (optional): List of fields to order the results by.
- `filters` (optional): Filter or List of filter objects.
- `limit` (optional): Maximum number of query results to return.
- `page_size` (optional): Number of results to fetch per query page.
Expand All @@ -246,6 +248,7 @@ def __init__(
self._genome_build = genome_build
self._result_class = result_class
self._fields = fields
self._ordering = ordering
self._debug = debug
self._error = error

Expand Down Expand Up @@ -284,6 +287,7 @@ def _clone(self, filters=None):
genome_build=self._genome_build,
limit=self._limit,
fields=self._fields,
ordering=self._ordering,
page_size=self._page_size,
result_class=self._result_class,
debug=self._debug)
Expand Down Expand Up @@ -581,6 +585,9 @@ def _build_query(self, **kwargs):
if self._fields is not None:
q['fields'] = self._fields

if self._ordering is not None:
q['ordering'] = self._ordering

if self._genome_build is not None:
q['genome_build'] = self._genome_build

Expand Down