find() filter to return field instead of entity

Hello everybody,

I am relatively new to shotgun but I have a question regarding making querries with find()

Here is a code sample:

def get_sgAllVersions(): #querries all created versions under shotgun
additional_filter_presets = [
"preset_name": "LATEST",
"latest_by": 'ENTITIES_CREATED_AT'
searchFilters = [
["project","is", stuproProject]
versions = sg.find("Version",searchFilters, ['code', 'entity', 'sg_status_list', 'user', 'description'], additional_filter_presets=additional_filter_presets)
return versions

which would return it like this for example:
 {'code': '010_0017_Comp_v024_xy049',
  'description': 'slower',
  'entity': {'id': 1437, 'name': '010_0017', 'type': 'Shot'},
  'id': 7912,
  'sg_status_list': 'vwd',
  'type': 'Version',
  'user': {'id': 142, 'name': 'Franz Hans, 'type': 'HumanUser'}}

Can I specify that instead of returning the whole shot or user entity I want shotgun to get a specific field of that entity  such as 'name' of entity and 'name' of user. This would increase code efficiency as I don't have to reiterate over the list again to format it.

Additional question: can you define how sg builds the datatype so that instead of returning a list of dictionaries sg should return it like this (dict with shotcode as key and list of other information as value for that key?

{shotcode : [name of entity, value of sg_status_list, ..]}



댓글 1개

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