2 comments

  • 0
    Avatar
    Erica Penk

    Was trying to figure out if pipeline step ids are consistent across all projects.  I adapted this from this example in the find() method documentation here: 

    https://github.com/shotgunsoftware/python-api/wiki/Reference%3A-Methods#usage-example-2-deep-linking

    Once you know the step.Step.id you can uncomment the pipeline_step_id line of code and only query tasks for that project and pipeline step.

    -----------------------------------------------------------------------

    fields = ['id', 'code', 'step.Step.id'] # add step.Step.id to figure out pipeline_step_id
    pipeline_step_id = 5 # ?? I did not know this value at first **
    project_id = 245 # 3d_pipeline_test

    # you can drill through single-entity link fields

    filters = [

        ['project','is', {'type': 'Project','id': project_id}],

        #['step.Step.id', 'is', pipeline_step_id]
        ]

    tasks = sg.find("Task", filters, fields)

    if len(tasks) < 1:
         print "couldn't find any Tasks"
    else:
         print "Found %d Tasks" % (len(tasks))
         print tasks

    ------------------------------------------------------------------------------------------------

    Cheers!

  • 0
    Avatar
Please sign in to leave a comment.