python.shotgun_model.data_handler_find module¶
-
class
ShotgunFindDataHandler
(entity_type, filters, order, hierarchy, fields, download_thumbs, limit, additional_filter_presets, cache_path)[source]¶ Bases:
python.shotgun_model.data_handler.ShotgunDataHandler
Shotgun Model low level data storage for use with the Shotgun Model.
This implements a data storage where a single shotgun find query is stored in the cache file.
-
generate_data_request
(data_retriever)[source]¶ Generate a data request for a data retriever.
Once the data has arrived, the caller is expected to call meth:update_data and pass in the received data payload for processing.
Parameters: data_retriever – ShotgunDataRetriever
instance.Returns: Request id or None if no work is needed
-
get_entity_ids
()[source]¶ Returns a list of entity ids contained in this data set given an entity type.
Performs a sequential scan over all items in the data set.
Returns: A list of unique ids for all items in the model. Return type: list
-
get_uid_from_entity_id
(entity_id)[source]¶ Returns the unique id for a given entity or None if not found.
Parameters: entity_id – Shotgun entity id to resolve Returns: unique id as string or int, to be used with get_data_item_from_uid()
.
-
update_data
(**kwargs)[source]¶ The counterpart to
generate_data_request()
. When the data request has been carried out, this method should be called by the calling class and the data payload from Shotgun should be provided via the sg_data parameter.The shotgun find data is compared against the existing tree and a list of differences is returned, indicating which nodes were added, deleted and modified, on the following form:
[ { "data": ShotgunItemData instance, "mode": self.UPDATED|ADDED|DELETED }, { "data": ShotgunItemData instance, "mode": self.UPDATED|ADDED|DELETED }, ... ]
Parameters: sg_data – list, resulting from a Shotgun find query Returns: list of updates. see above Raises: ShotgunModelDataError
if no cache is loaded into memory
-