Conversation
7f437da to
45092b7
Compare
Codecov Report
@@ Coverage Diff @@
## master #3526 +/- ##
==========================================
+ Coverage 88.29% 88.36% +0.06%
==========================================
Files 323 323
Lines 33878 34047 +169
==========================================
+ Hits 29912 30085 +173
+ Misses 3966 3962 -4
Continue to review full report at Codecov.
|
|
good catch. This needs unit tests! does that also fix #3527 ? |
ae99f21 to
f4d0848
Compare
|
I've added unit tests, however, I haven't found a usage of the database It doesn't fix #3527, in fact I discovered #3527 while working on this. For a given list property of a database object the |
f4d0848 to
23e237d
Compare
|
Hi @jangmarker the Rest API filtering is featured around the needs for the UI. If you have usecases, I think it makes more sense to have the contains operator have a default 'or' behaviour. It better matches the behaviour for 'eq'. |
master/buildbot/data/resultspec.py
Outdated
| plural_operators_sql = { | ||
| 'eq': lambda d, v: d.in_(v), | ||
| 'ne': lambda d, v: d.notin_(v), | ||
| 'contains': lambda d, vs: (v.in_(d) for v in vs), |
There was a problem hiding this comment.
needs a plural test for contains. I am not sure how this code would work
master/buildbot/data/resultspec.py
Outdated
| @@ -49,17 +49,26 @@ class FieldBase(object): | |||
| 'contains': lambda d, v: set(v) <= set(d), | |||
There was a problem hiding this comment.
looks like this 'old' code should provide a OR behaviour at data API level.
It is just the sql mode which was not implemented
There was a problem hiding this comment.
Currently the old code does not provide OR behavior. For instance:
- https://nine.buildbot.net/api/v2/builders?tags__contains=buildbot&order=builderid
yields multiple builders, includingbuilderid: 1(first one) - https://nine.buildbot.net/api/v2/builders?tags__contains=try&order=builderid
yields one builderbuilderid: 1 - https://nine.buildbot.net/api/v2/builders?tags__contains=try&tags__contains=buildbot&order=builderid (combination of 1+2)
yields only one builder (AND behavior), but with OR it would yield all builders shown in the queries 1 and 2
I'll create a new pull request that changes the contains behavior to OR and then will adapt this request accordingly.
|
@jangmarker I think you wanted to rebase this PR? |
23e237d to
e26cf36
Compare
|
Yes, sorry, I didn't make it before vacation. My response times will be rather slow until September. |
Fixes queries like: /api/v2/builds?builderid__eq=1&builderid__eq=2 This would have yielded an empty result with the previous code.
e26cf36 to
313c3d1
Compare
313c3d1 to
624ec02
Compare
Fixes queries like:
/api/v2/builds?builderid__eq=1&builderid__eq=2
This would have yielded an empty result with the previous code.
Contributor Checklist:
master/buildbot/newsfragmentdirectory (and read theREADME.txtin that directory)code is fixed to match the documentation