Bulk delete Retool storage

Hi

I am trying to bulk delete all Retool storage. Is there a way to do this?

Thank you

@dan.johnson You can use a workflow to delete multiple files from Retool Storage. Pass an array of file IDs to the workflow. Within the workflow, loop through the array to execute the delete query for each file ID. This way, you can effectively manage the response and implement proper error-handling messages in the app.

Do I understand this correctly?

Retool is incapable of working with it's internally stored files in bulk outside workflow lamda loops?

Feeding an array of records to file id field returns an error.

This does not work either. What am I doing wrong?

Is it just me or Retool storage feels a little off compared to other file storage services.

Hey @Scottsky @dan.johnson @ZeroCodez,

Great idea! You may want to use an app query as a less expensive option as opposed to a workflow. You'll need to write a query to get all the metadata you need and transform the result to filter and map to just be the ids. Then you should be able to write another query that deletes everything from Retool Storage with that id.

Went ahead and submitted a request for bulk deletion of Retool Storage.

Feels like that's what I was trying to do in the screenshot above, but miserable failed. Can you help me determine where exactly I screwed up formatting it correctly, please. The code1 block seem to do exactly that.

1 Like

Absolutely!

I made a simple app that
emptyRetoolStorage.json (13.8 KB)
you can take a look at. It works by calling the getFileIds query, which I commented out to avoid anyone from accidentally emptying their Retool Storage. It can be refactored to delete specific items from Retool Storage.

Let me break down how the app works a bit. Firstly, I recommend using a web app since it's a less expensive option compared to workflows. :slight_smile:

The first query we can look at together gets the ids of all the files in your Retool Storage.


On success, I've set up an event handler that will call the javascript query below:

This query loops through the file ids and triggers a query called deleteFile that accepts a file id we passed as additional scope and deletes it from Retool Storage.
Here's the query for deleting a file. Be sure to add the key/variable you created using additionaScope in the Advanced settings section so that the variable is in scope to the query.

Hope all of the helps! Let me know if you have any roadblocks!

4 Likes

Thank you. I think I understand it now.

1 Like

Fantastic! I'll let you know about any updates on this feature request :+1:

1 Like