Shotgun schema

  • Data in Shotgun is organised into entities (roughly analogous to tables in a database)
  • Entities have fields, also called attributes (like columns in a database table)
  • Each entity has the following attributes:
    • ID
    • Code or Name
    • Type
    • And some other attributes. Because all the other attributes are configurable, the API has simple tools to query them dynamically.
  • The API is very simple: CRUD and lots of lists of lists
  • The API has tools to help you discover the schema. You can also go to the Fields page, in the Admin menu, to see a list of all the fields configured on your site. Note that fields have an internal name which is used by the API, and a display name that’s used in the UI. They’re generally very similar to each other, but not necessarily predictable. Check the Fields page to see both.
  • Shotgun provides some specific methods for dealing with thumbnails and files as file can be uploaded or locally linked.
  • And you can link entities together using special “entity” type fields. Through the UI, we can see that sequence bunny_010 has 4 Shots and 4 Assets linked to it.


>>> filters=[['code','is','bunny_010']]
>>> fields=['assets','shots']
>>> seq = sg.find('Sequence',filters,fields)
>>> pprint(seq)
[{'assets': [{'id': 740, 'name': 'Branch', 'type': 'Asset'},
             {'id': 726, 'name': 'Buck', 'type': 'Asset'},
             {'id': 749, 'name': 'Flower', 'type': 'Asset'},
             {'id': 732, 'name': 'Squirrel', 'type': 'Asset'}],
  'id': 4,
  'shots': [{'id': 860, 'name': 'bunny_010_0010', 'type': 'Shot'},
            {'id': 861, 'name': 'bunny_010_0020', 'type': 'Shot'},
            {'id': 862, 'name': 'bunny_010_0030', 'type': 'Shot'},
            {'id': 863, 'name': 'bunny_010_0040', 'type': 'Shot'}],
  'type': 'Sequence'}]

Behind the scenes, a standard Shotgun schema looks a bit like this (yours may look different):

9 Version Page or Smart Playlist (not listed): This is a generic page in Shotgun with a page query that defines the list of Versions to display. For example, you may have a page called “Pending Review” that shows all Versions with a status set to “Pending Review”. Every time the Page is accessed, it is refreshed to show all Versions that match that query.

10 Sub-Assets and Sub-Shots: Built-in fields that can be used to represent a parent/child relationship between Assets and Shots, respectively. An example is if you have an Asset that’s a character. Sub-Assets would be items that belong to the character, such as costumes, props, and flair.



Please sign in to leave a comment.