Sort and limit #24

merged 44 commits into from Mar 28, 2013


None yet

5 participants


Add the ability to sort and limit queries in the read API. This includes a rewrite of how grouping is done so that the sorting and limiting could be shared. It also changes the output format to match the wiki as per discussions during the course of the story.


I don't think this is right, it doesn't match the wiki documentation or the usage in limelight.


Feel free to change, with the proviso that if we have logic around the ordering of a result we should be testing that logic. What is the expected result?

robyoung and others added some commits Mar 27, 2013
@robyoung robyoung Add stop flag to behave
Behave doesn't stop and returns a zero exit status on failures. This is
not ideal. Passing the stop flag forces it to stop and exit with a
status of one.
@robyoung robyoung Change default sort order to ascending
After discussing with @abersager ascending chronological order is a more
convenient default.
@robyoung robyoung Refactor database integration tests
Slightly refactor to remove duplication in fixture setup.
@robyoung robyoung Add test for sorting by non-existent key ecbff5f
@robyoung robyoung pep8 6f66ce1
@robyoung robyoung Tee pep8 output so that it's visible in CI console 7baf6f7
@robyoung robyoung Rename sort parameter to sort_by
It was sort_on in the feature test, sort in the code and sort_by in the
wiki. The wiki rules!

@robyoung robyoung Add basic query sorting to Bucket 0c09d22
@robyoung robyoung Fix query sort feature test
- Explicitly expect an integer, by default the numbers are parsed as
- Extract nth result position parsing in step definitions
- Add 'first' and 'last' options for result position parsing.

@robyoung robyoung PEP8! 3dbc35d
@robyoung robyoung Add limit to read API
- Allow the user to limit the number of results returned

@robyoung robyoung Add test to verify sort and limit together 86816c8
@maxfliri @robyoung maxfliri Conform response for grouping query to api design c6716ac
@robyoung robyoung Add sort by to grouped query e684ed7
@robyoung robyoung Add limit to grouped query ecc6c42
@robyoung robyoung Switch order of nesting in periodic grouped query 4f02732
@robyoung robyoung Extract and simplify group integration tests
They were getting a bit disjointed and hard to follow. This pulls them
out into their own class with a common fixture used across all the
@robyoung robyoung Refactor grouping and repo response format
This makes both grouping functions in database.Repository use the same
code. It also changes the output to be nested lists and therefore allow
@robyoung robyoung Add sorting to multi group query 85bb567
@robyoung robyoung Add limit to multi group query f793e25
@robyoung robyoung Add limit to period query 26932d4
@robyoung robyoung Don't allow sorting of periodic queries a53c464
@robyoung robyoung More descriptive error messages 9a754d6
@robyoung robyoung Merge branch 'master' into sort_and_limit
@robyoung robyoung Refactor nested merge function
An attempt to make it a bit clearer what's happening.
@robyoung robyoung Minor, largely cosmetic improvements
Rename some variables to be more clear about their purpose
Make some conditions simpler
Remove some whitespace

@pbadenski pbadenski merged commit 694427e into master Mar 28, 2013

1 check passed

default Build #103 succeeded on Jenkins
@pbadenski pbadenski deleted the sort_and_limit branch Mar 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment