0

Find asset by name

Hi people, I'm new to shotgun.  I can't find a link that contains all the internal column names per table (shot asset etc).  Perhaps I have to get that from the schema.

Anyway, simply I'd like to do the below.

project = sg.find("Project", [["name", "is", "test"]])
asset = sg.find_one("Asset", [["project", "is", project], ["asset_name", "is", "bob"]])

Thanks

 

David

 

2 comments

  • 0
    Avatar
    Kym Watts

    Hi David,

     

    In a 3d asset, the name field on the back end is called "code" so:

    asset = sg.find_one("Asset", [["project", "is", project], ["code", "is", "bob"]])

     

    There are 2 ways i use to get the columns/field names im after.

    In spread sheet view, right click the column label > select "configure field",  in the window that pops up, on the top row, it will have "Field code:" , what comes after this is the field name.

    The other way to do it, is in the admin menu > select Fields from the menu. then make a filter by the "3D Asset" type, this will show you a list of all the fields on the 3d asset type, it will then show you the Field name and its Field code, you want the Field code that matches The field names you want to query.

    Its better, to ask shotgun for the Fields you need, instead of everything and having slow queries.

     

    Hope this helps.

    Kym

     

  • 0
    Avatar
    David Moulder

    Kym, thanks for you input.  This saved me a ton of searching and gave me a way to find the field names for myself.  Thanks!

    "Its better, to ask shotgun for the Fields you need, instead of everything and having slow queries."

    I see,  I'll try that next.  Thanks again.

Please sign in to leave a comment.