Connected SG queries

Hi everyone, I was wondering if there was a way to get info for every version in a playlist and the status info for every shot and task associated with each version.

Basically right now I am able to info on each version in a playlist but then I have to do a separate search to get the data on the tasks and shots associated with each version. This can take quite a while when you have 200+ versions in a playlist!


What I currently do:

for version in versions:

    shotData = sg.find_one('Shot', [['id','is',version['entity']['id']]], ['sg_status_list'])
    taskData = sg.find_one('Task', [['id','is',version['sg_task']['id']]], ['sg_status_list'])


PlaylistVersionConnection seems like a good start because it lets me get ALL of the version info for each version in the playlist, but it stops there and doesn't seem to let me go one step further. Thanks everyone!


  • 0
    Rob Blau

    Hi there Robin,

    You should be able to get all that info in a single query if you have the playlist id.  Does something like this return what you are looking for:

    sg.find('Version', [['playlists', 'is', {'type':'Playlist', 'id': PLAYLIST_ID }]], fields=['sg_status_list', 'sg_task.Task.sg_status_list'])