API: Find all local file links using a specific LocalStorage

We’re trying to clean up a lot of things in our SG instance. One of them is the Local Storages defined in Shotgun.

Is there any way to query ALL of the local file links using a specific LocalStorage?

When looking at the Attachments I can filter down using some hints of things that aren’t populated to at least get a list of Attachments that are local file links. But you can’t filter by the file itself (which contains the info about the local storage used).

Otherwise, will have to go through the literal millions of Attachment entities and check each one. Doable… but very inelegant and would love it if there was “a better way”.


1 Like

So I’m taking the lack of response to mean we’ll just have to go through all of the Attachment entities and examine each one :/.

FWIW, I think there should be a much easier way to do this. Similar to how PublishedFiles have a Path Cache Storage field on them, if Files had a LocalStorage field that held this info for local file links, that would be extremely valuable.

  1. For seeing all files that use a specific storage if we need to see what files may be affected if we need to update this storage.
  2. For seeing which entities need updating when fixing any local file links that may be connected to the wrong storage (for example if there were 2 local storages with the same root definitions)

I’m sure there are more use cases as well.

Not sure if I am misunderstanding, but this works:
shotgun.find_one("Attachment", [["local_storage", "name_is", "caches"]])

@mmoshev Ah yes of course via the API, which is what we’ve started to do.

But initially I was asking to see this info via the UI. PublishedFiles expose a similar field via the UI but Attachments don’t. Would just make this easier to find so we don’t have to use the API to gather this info

Indeed that’s odd that it’s not exposed in the UI.