Dear AiiDA users,
I just encountered some strange AiiDA behaviour. Here is a sample of my code:
from aiida.orm import Data
class P(Data):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
class P1(P):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
class P2(P):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
As you can see, P<class> is a subclass of Data<class>, and P1 and P2 are subclasses of P. I assume when I build a query searching for all Data node I should find all of them, and that's true:
P().store()
P1().store()
qb = QueryBuilder()
qb.append(Data)
for x in qb.iterall(): print(x)
results in:
[<P: uuid: 61b02ab5-1049-4430-814f-c2d273f8bb81 (pk: 18)>]
[<P1: uuid: 44fd554d-bee1-4cd3-8aaf-d8e29acf46ca (pk: 19)>]
This is expected behaviour for me. But when I querry for P class its subclasses are missing:
qb = QueryBuilder()
qb.append(P)
for x in qb.iterall(): print(x)
[<P: uuid: 61b02ab5-1049-4430-814f-c2d273f8bb81 (pk: 18)>]
This is not What I expected. So what am I missing?
cheers
Otto