-
Notifications
You must be signed in to change notification settings - Fork 94
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
Django style filtering for GetEntitySetRequest #113
Django style filtering for GetEntitySetRequest #113
Conversation
I am not sure what a linter you use but neither pylint nor flake8 are configured to enforce use of double quotes. In general, please avoid code style changes - my ideology: what was once accepted to master should stay formatted as it is unless there are other reason for touching it (code style changes makes reviews almost impossible). |
d7a08a3
to
f5000cc
Compare
Apologies, VSCode was pointed to the wrong env and had our internal linting rules applied. This has been rectified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to test your branch on my machine without the style fixes commit which you reverted few moments ago. I got a merge conflict in cherry-pick to the current upstream master. I wanted to fix the merge conflict but I ended up fixing all the changes. This is my review:
filak-sap@548c12e
(it contains your commit ff2288a )
Would you mind if I push the version after applying the patch filak-sap@548c12e ? |
You can see the version after my changes at: master...filak-sap:django_style_filter_review |
Looks good to me! @filak-sap I'm currently writing a feature that lets us access the ETag header in an entity to be used in time based If-Match queries and fixing a bug where huge responses are causing a parsing error in ODataHttpResponse. After I'm done with these could we please look at making a release? |
Closes #113 Signed-off-by: Jakub Filak <jakub.filak@sap.com>
Closes SAP#113 Signed-off-by: Jakub Filak <jakub.filak@sap.com>
The existing filtering mechanism is not very intuitive, requiring interpolation of OData queries or using the convoluted boolean logic syntax of
GetEntitySetFilter
to achieve complex queries.I have implemented a Django-like filtering system that allows filtering of EntitySets in a much more intuitive way.
Syntax
For example, a simple equivalency query was previously written like this:
or even more confusingly:
With this proposed update, future calls will look like this.
Tell me that's not way more beautiful. ;)
Filter Expressions
Next, I have implemented some lookups using Django-like syntax that opens up some more advanced query scenarios.
The operators
lt
,lte
,gt
,gte
,in
,contains
,startswith
,endswith
,length
andrange
have been implemented.Examples below:
There is also the introduction of the
FilterExpression
class which is equivalent to Django's Q class.This allows common queries to be stored as objects:
This also allows the
or
operator to be used to or statements:All changes are backwards compatible and do not disrupt existing implementations of this library, and upgrading to this syntax should be simple if not trivial.