Skip to content

Add support for a tuple of classes or types in the QueryBuilder.append#1607

Merged
lekah merged 4 commits into
developfrom
fix_1398_tuple_qb_append
May 30, 2018
Merged

Add support for a tuple of classes or types in the QueryBuilder.append#1607
lekah merged 4 commits into
developfrom
fix_1398_tuple_qb_append

Conversation

@sphuber
Copy link
Copy Markdown
Contributor

@sphuber sphuber commented May 30, 2018

Fixes #1398

The current implementation of QueryBuilder.append only allows to add a single orm class through the cls or type argument, however, often one would want to add a tuple of classes, provided they share a common base class. This pull request implements this functionality

Leonid Kahle added 4 commits May 29, 2018 18:03
…, lists or sets as classes. This works now only for keyword cls and for the django backend, but the path has been laid out for the rest. Added also a test, that currently fails for types being set to tuples, since this is the next thing to fix
…/lists/set. A bit of code-refactoring was done to make the code a bit easier to read and avoid code-cuplication. This also prompted removing one method from the interface of the QueryBuilder. This issue is probably resolved at this stage, but a few more tests and additional documentation would not hurt
@sphuber sphuber requested a review from lekah May 30, 2018 08:38
@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #1607 into develop will increase coverage by 0.05%.
The diff coverage is 92.45%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1607      +/-   ##
===========================================
+ Coverage    57.11%   57.17%   +0.05%     
===========================================
  Files          273      273              
  Lines        33795    33773      -22     
===========================================
+ Hits         19302    19309       +7     
+ Misses       14493    14464      -29
Impacted Files Coverage Δ
aiida/backends/general/querybuilder_interface.py 59.18% <ø> (+0.36%) ⬆️
.../djsite/querybuilder_django/querybuilder_django.py 82.81% <ø> (-2.18%) ⬇️
aiida/backends/sqlalchemy/querybuilder_sqla.py 72.24% <ø> (+1.23%) ⬆️
aiida/orm/querybuilder.py 74.16% <92.45%> (+2.83%) ⬆️
aiida/backends/djsite/db/models.py 75.97% <0%> (+0.88%) ⬆️
aiida/backends/djsite/globalsettings.py 86.84% <0%> (+5.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d380cc4...054e4c1. Read the comment docs.

@lekah lekah merged commit d5f5d21 into develop May 30, 2018
sphuber added a commit that referenced this pull request May 30, 2018
#1607)

The `append` method of the `QueryBuilder` now accepts a tuple, list or set of orm classes
for the `cls` and `type` keyword argument, with the one restriction that all classes share a
common base class. This allows the user to append a join for a set of classes with the same
projection and filtering rules
@sphuber sphuber deleted the fix_1398_tuple_qb_append branch May 30, 2018 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants