Jump to content

Query tasks from Sequence (or other entity type where a task is a child)


mark

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...