Jump to content

Recommended Posts

Posted

Hi

I want to get some shot by his name from the project in one query, how I need to combine criteria

 

proj = session.query('Shot where name is "{0}" and Project where name is "{1}"'.format('sh01', 'dev'))

 

 

  • Vlad Skrypnyk changed the title to Get shot in the project by name at one query
Posted

Hi, when typing "Project where" you are using the syntax to go look for projects of the "Project" table.

What you actually want to filter is the "project" attribute of the Shots:

my_shot = session.query('Shot where name is "my_shot" and project.name is "the_project"').first()

# while we are at it the "like" syntax can be useful here to get all shots that starts with a given prefix
# (but you should probably use a proper Folder/Sequence to organise your shots)

# for exemple let's say shots from the SequenceA of my project are prefixed with "sqa"
sqa_shots = session.query('Shot where name like "sqa%" and project.name is "the_project"')

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...