0

Update to a multi-entity list field

I have a lot of Asset-entities (in the order of 1000) linked to a shot. Even if I want to link and unlink a new asset to the shot, I need to pass the entire list of assets with one shotgun-update command.  This is very network intensive as well as time-consuming. 

Is there a simple way of modifying(add/delete) the list of these Asset-entities rather than overwriting it every time ?
Example code
mission = sg.find_one("Shot", [ ], ['id', 'assets'])
request = {'request_type':'update', 'entity_type':"Shot", 'entity_id': shotId}
assets = mission['assets'] // This is a list of ~1000 assets.
for asset in assetsToAdd:
    assets.append({'type': 'Asset', 'id': asset['id']);
request['data'] = {'assets': assets} // This request now contains more than 1000 assets. So the update is going to take a lot of time.
shotgun_api.batch([request])

 

1 comment

  • Avatar
    Brandon Foster Official comment

    Hi Sumeet!

    This functionality has been added to the 3.0.30 release of the API. See the multi_entity_update_modes variable in the update() command to learn more.

Please sign in to leave a comment.