Retrieving linked data beyond just id,name,type?

A very frustrating limitation of the find() and find_one() methods seems to be the inability to ask for more than just the id, name, and type fields for linked data in a retrieved entity. For example, suppose I want to retrieve the Note entities associated with a particular Shot, and among the data that I want returned, I want the Task entities.

fields = [ "subject", "user", "content", "tasks" ]

results = shotgun.find("Note", [["note_links", "name_is", shot_name]], fields)

When I get the results, the 'tasks' field of the returned Note entities only contains a list of minimal Task entities (id, name, and type fields only). But I need more than that. I need numerous other Task entity fields returned to me (e.g., step, duration, sg_status_list), but I see no way to specify them. I don't want the overhead of another shotgun query just to get "the rest of the data" for each Task entity retrieved from the first query.

Am I correct in believing there is currently no method of specifying nested link fields as part of the returned "columns" of data?

1 条评论

  • 0
    Mike Boers

    You actually can retrieve fields on a directly linked entity! For example:

    >>> sg.find('Task', [('id', 'is', 43897)], ['id', 'step', 'step.Step.entity_type', 'entity', 'entity.Shot.sg_sequence'])
    [{'entity.Shot.sg_sequence': {'type': 'Sequence', 'id': 101, 'name': 'GC'}, 'entity': {'type': 'Shot', 'id': 5801, 'name': 'GC_001_001'}, 'step.Step.entity_type': 'Shot', 'step': {'type': 'Step', 'id': 5, 'name': 'Animation'}, 'type': 'Task', 'id': 43897}]

    This only works one level deep; you can't get anything but the default fields on a Sequence linked to a Shot linked to a Task.

    I do believe this is in the docs somewhere, but I'm not sure where...