QueryBuilder search for multiple with_incoming

Is it possible to filter for multiple conditions in with_incoming?
For example, I’d like to extend the following query to consider CalcJobNodes that have been produced by a given code using a given structure as input:

qb = QueryBuilder()
#code = Code.get_from_string('qe-sirius@daint')
#qb.append(Code, filters={'uuid': code.uuid}, tag='code')
qb.append(StructureData, filters={'uuid': 'c81a5945-7872-479e-9624-cfb5ecf48dea'}, tag='structure')
qb.append(CalcJobNode, with_incoming='structure', tag='calc')
# this doesn't work
#qb.append(CalcJobNode, with_incoming=['structure', 'code'], tag='code')
qb.add_projection('calc', ['id', 'pk', 'uuid', 'ctime', 'attributes.exit_status'])

Hi @simonpintarelli

I think it works if you combine with_incoming at the CalcJob level and with_outgoing at the Code level:

q = QueryBuilder()
q.append(orm.StructureData, filters={'id': 907076}, tag='strct')
q.append(CalcJobNode, with_incoming='strct', tag='calc', project='*')
q.append(Code, filters={'id': 8566}, with_outgoing='calc')
q.all()

Hope that helps!

And let me know if it doesn’t work for you.

Hi Timo,

thanks a lot! This worked.