Shotgun schema

Data in Shotgun is organized into entities, somewhat similar 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

There are 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 (,_read,_update_and_delete), 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 a “Field Code” which is used by the API, and a “Field 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 files can be uploaded or locally linked.

You can link entities together using special “entity” type fields. Through the UI, we can see that sequence SATL has seven Shots (first image below) and six Assets (second image below) linked to it.

Sequence_SATL Demo Animation with Cuts

Sequence_SATL Demo Animation with Cuts 2

From a Python console (or via the Shotgun API), we can query the Shots and Assets associated with the SATL sequence: 

>>> filters=[['code','is','SATL']]
>>> fields=['assets','shots']
>>> seq = sg.find('Sequence',filters,fields)
>>> from pprint import pprint
>>> pprint(seq)
[{'assets': [{'id': 1402, 'name': 'Blaster Pistol', 'type': 'Asset'},
{'id': 1406, 'name': 'Hatch', 'type': 'Asset'},
{'id': 1404, 'name': 'Satellite', 'type': 'Asset'},
{'id': 1405, 'name': 'Ship', 'type': 'Asset'},
{'id': 1401, 'name': 'Sven', 'type': 'Asset'},
{'id': 1403, 'name': 'Trilobot', 'type': 'Asset'}],
'id': 40,
'shots': [{'id': 1162, 'name': 'HSM_SATL_0010', 'type': 'Shot'},
{'id': 1163, 'name': 'HSM_SATL_0015', 'type': 'Shot'},
{'id': 1164, 'name': 'HSM_SATL_0020', 'type': 'Shot'},
{'id': 1165, 'name': 'HSM_SATL_0030', 'type': 'Shot'},
{'id': 1166, 'name': 'HSM_SATL_0040', 'type': 'Shot'},
{'id': 1168, 'name': 'HSM_SATL_0050', 'type': 'Shot'},
{'id': 1167, 'name': 'HSM_SATL_0060', 'type': 'Shot'}],
'type': 'Sequence'}]

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

Hover over the blue boxes in the image below to get a more robust description of each element of the Schema.