-
Notifications
You must be signed in to change notification settings - Fork 191
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
Change 'ancestor_of'/'descendant_of' to 'with_descendants'/'with_ancestors' #2278
Change 'ancestor_of'/'descendant_of' to 'with_descendants'/'with_ancestors' #2278
Conversation
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've got a couple of comments/questions
aiida/orm/querybuilder.py
Outdated
@@ -1659,7 +1661,7 @@ def _build(self): | |||
isouterjoin = verticespec.get('outerjoin') | |||
edge_tag = verticespec['edge_tag'] | |||
|
|||
if verticespec['joining_keyword'] in ('descendant_of', 'ancestor_of'): | |||
if verticespec['joining_keyword'] in ('with_ancestors', 'with_descendants'): |
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.
If the user uses the old 'descendant_of', will this still work? Maybe we should keep all four options for now?
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.
Yes, well spotted. Put these back in.
aiida/orm/querybuilder.py
Outdated
@@ -1262,7 +1262,7 @@ def _join_descendants_recursive(self, joined_entity, entity_to_join, isouterjoin | |||
""" | |||
|
|||
self._check_dbentities((joined_entity, self._impl.Node), (entity_to_join, self._impl.Node), | |||
'descendant_of_beta') | |||
'with_ancestors_beta') |
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.
Is this _beta
version still implemented? Probably @lekah can answer this
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.
No, what we're doing now (transitive closure on the fly) used to be called _beta. This string passed is just for the exception, and can be changed without a problem (i.e. remove _beta in the string).
My suggest: without a new issue within this pull request, if noone objects.
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.
Good for me!
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.
Made these changes.
- Deprecate ancestor_of and descendant_of - Replace all occurances of ancestor_of with with_descendants - Replace all occurances of descendant_of with with_ancestors - Update docs with this convention
- Remove _beta versions of ancestor_of and descendant_of joins - Add ancestor_of and descendant_of back in to check for valid join keywords.
ca412b7
to
8758769
Compare
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.
Great!
Fixes #2209 .
Deprecates the Querybuilder 'ancestor_of'/'descendant of' join type specifications and replaces them with 'with_descendants'/'with_ancestors' respectively. All deprecated uses are updated and the docs changed to reflect this new convention.