mark Posted June 13, 2017 Report Share Posted June 13, 2017 Hi, I'm aware of how to query tasks from project but is there a way to query them from a different level such as sequences? i.e. -- session.query('Task where sequence.id is {}'.format(sequence_id).all() where sequence_id would of course be the sequence id. This doesn't work nor does parent.id because a sequence is not a direct parent of a task. Otherwise I need to know the object type of the parent I'm trying to query from (I don't always...it could be a shot, an asset build, etc) Is there a clear way of doing this from a just an entity's name or id? Thanks! -Mark Link to comment Share on other sites More sharing options...
tokejepsen Posted June 14, 2017 Report Share Posted June 14, 2017 Hey Mark, You are probably best off looking at all the parents: parents = [] for item in task['link'][:-1]: parents.append(session.get(item['type'], item['id'])) Link to comment Share on other sites More sharing options...
Eric Hermelin Posted June 14, 2017 Report Share Posted June 14, 2017 Hi, You could use TypedContext and the ancestors field sequence_id = '776f0e0c-0636-483c-9868-79d6157a3787' child_tasks = session.query( 'TypedContext where ancestors any(id="{0}")'.format(sequence_id) ) An other option is to use the parent field relationship child_tasks = session.query( 'Task where parent.id = "{0}" or parent.parent.id = "{0}" or parent.parent.parent.id="{0}"'.format( sequence_id ) ) cheers Eric Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.