Reuse uploaded file attachments

Hi everyone!

If I understand correctly file attachments to fields are never deleted, just overwritten by new entries. So my question is: Is it possible to reattach older attachments to some field again via code or web interface? I did not find anything.

My use case for this is this:
We are using uploaded configs in our SGTK setup and it would be great to simply relink older uploaded configs in the case we need to quickly rollback.

Would the following not work?

Create some script that creates a new primary config, uploads your new config and then renames the older config to something that identifies the old one.

That way your config will keep its uploaded config?

Hi @Ricardo_Musch !
Yes that would work but I’d like to keep my handful of configs and not blow them up with extra ones.
Well, in the end it is not that big of a deal, I can live with uploading old versions to the config. Just wanted to know if it is possible in general or not. I am just curious if that is the intended way things work, because right now you basically create a “dead” attachment each time you upload a new file to a field. And as far as I can see these never get cleaned up. They just live in ShotGrid limbo which seems odd to me. Maybe one of the ShotGrid devs can shed some light onto it. :slight_smile:

Cheers

1 Like

I would imagine there is some type of cleanup method that either removes any orphaned attachements from S3 or puts them into S3 tiered storage so it won’t cost much to keep them.

1 Like

These do in fact stick around “forever” in the Attachment world it seems.

Not to hijack this thread but we have a related issue that highlights this. We have 4-5 configs that get uploaded across 50+ shows. Since the project field is a single entity on PipelineConfigurations, we have to upload each config to each project every time we do an update. This duplicates the attachments a TON (especially over time).

If the project association field on PipelineConfiguration was multi-entity projects this would save an immense amount of storage, orphaned Attachments, and time deploying for us.

Yes, that really accumulates quickly. We only have 2 configs but that already is enough to generate quite a lot of data in SG.
Would be great to have a possibility to (re-)link attachments to any “file”-field that you like. So basically upload once and than link it to any field you like. I think this would also save space on the local shotgrid cache, because the config would be reused instead of being downloaded for each project again and again.
And yes I would also welcome a multi-entity projects field on the PipelineConfigurations. Quite a bit of work to change that though :face_with_diagonal_mouth:

I too tried to reuse attachments when I was setting up our deployment strategy for our distributed configs. I ended up in the same boat as you guys, reuploading the same config for every new project. It definitely ends up eating some extra disk space. To keep the size down of our zipped configs I only bundle a few apps in our config, and let the rest stand as app_store / git descriptors. At least that way the overwhelming majority of our apps, engines, and frameworks are shared from the users global bundle_cache. That may or may not be an option for you depending on your studio though.

2 Likes

You could use some methods in the bootstrap.py core hook to add a token for github downloads I think.

As for bundle cache, you want to keep that locally cached or synced between machines as apps become horribly slow when loading of a network drive (python on network drives is slooooow)

1 Like