aiida-core icon indicating copy to clipboard operation
aiida-core copied to clipboard

Option to specify "not in any group" in `QueryBuilder` query

Open GeigerJ2 opened this issue 8 months ago • 2 comments

Currently, and only the membership of a Node to a given Group can be set in the QueryBuilder, but it's not possible to query for nodes that don't belong to any group.

GeigerJ2 avatar Apr 10 '25 14:04 GeigerJ2

Hi @GeigerJ2 !

I'd love to solve this , my idea is to extend the with_group logic to handle None (or __NONE__) and return nodes not in any group using a left outer join and filtering for NULLs.

Thank You!

Muhammad-Rebaal avatar Apr 13 '25 18:04 Muhammad-Rebaal

Dear @Muhammad-Rebaal, thanks for your interest in this issue. Feel free to give it a shot and create a PR, including the relevant tests. I'm not really familiar with SQL myself, so I cannot judge the feasibility of the approach you propose. Pinging @rabbull, as he has been successfully contributing to the ORM part of AiiDA, so maybe he can assist/review.

GeigerJ2 avatar Apr 17 '25 07:04 GeigerJ2