Quering find with a list?


I am trying do an effective sg.find for shots, but only for active projects. Heres what I`m thinking so far.


all_projects = sg.find("Project",filters=[['sg_status', 'is_not', 'Archive'],['name', 'is_not', 'Template Project']],fields=['name'])

all_shots = sg.find('Shot', filters=[['sg_status_list', 'is_not', 'omt'], ['project', 'is', all_projects ]], fields=['project', 'code','sg_sequence']])


Tried a couple of ways to give the "project is" line a list, but its always expecting some [Hash, NilClass].

Is this a stupid way to do this?

Still quite new to python, so any help is greatly appreciated.

댓글 2개

  • 0
    Marc Dubrois

    you can use this syntax

    filters = [['sg_status_list', 'is_not', 'omt'], ['project.Project.sg_status','is_not', "Archive"], ['project.Project.name','is_not', "Template Project"]]
    fieldsReturn = ['project', 'code','sg_sequence']
    all_shots = sg.find('Shot',filters, fieldsReturn)

  • 0

    That works just awesome! Thank you very much for a great and quick reply!

    This will solve alot of problems!

댓글을 남기려면 로그인하세요.