I just noticed that when you delete (retire) an entity, its events are no longer visible. I knew this was the case in the UI, but assumed we could get at them from the API the way you can query any other retired entity, using the find()
method with the retired_only=True
parameter. However, it appears this isn’t the case and there is no way to query EventLogEntries
for a retired entity.
Is this a bug?
>>> sg.find("EventLogEntry", [["entity", "is", {"type": "Task", "id": 14873}]])
[{'type': 'EventLogEntry', 'id': 1096400}, {'type': 'EventLogEntry', 'id': 1096401}, ...
>>> shotgun.delete("Task", 14873)
True
>>> sg.find("EventLogEntry", [["entity", "is", {"type": "Task", "id": 14873}]])
[]
>>> sg.find("EventLogEntry", [["entity", "is", {"type": "Task", "id": 14873}]], retired_only=True)
[]
One could argue that there are cases where you still want to get this information. In my case, an entity was deleted, and as part of that deletion the field that holds the key
for the entity in another system we’re integrating with was cleared. I now need to see this what the value of the key
was before it was deleted. Since the value was cleared, I can’t get it from the entity itself, I have to look in the event history. But I can’t get the event history unless I revive the entity. I can’t revive the entity without triggering a lot of things I don’t want to trigger.
Just seems like this is an undocumented exception in the norms of how entities work.