Display applications a Resource is used in

We ended up deprecating an end point and I need to change the retool apps which used this end point. I couldn't find a way to determine which apps used the endpoint. I had to go into each application and manually review the Resource being used for the queries there.

It would be really helpful to have a way of seeing which apps a Resource is being used.

8 Likes

Same here. I went ahead and deleted a few resources in hope they are not needed.
Is there any way to see this without clicking through all the apps and all their queries? Is there some way of "exporting all apps" so I could at least grep in some kind of json file?

1 Like

As of now, apps need to be exported and imported individually.

Hi @Jay , I am not following how the import and export of an app is related to knowing which apps are using a specific Resource. Thank you!

Great feature request, @brettski, but my response was to the question above.

re: Is there some way of "exporting all apps" so I could at least grep in some kind of json file?

>> As of now, apps need to be exported and imported individually.

I am not sure how I missed that @Jay. My apologies.

Brett

Is there an api endpoint to get all apps that we could enumerate to then export and parse for resource usage?

Hey @kdawgwilk-jasper!

At the moment that isn't a built-in feature though it has been requested a couple of times so you're definitely not alone in wanting it!

Both displaying all apps that use a particular resource and having an endpoint for listing existing apps are on the dev team's radar. They haven't been picked up as projects yet but if and when they are included we can report back here!

Unfortunately for Cloud users, you'll still need to manually export your apps individually from your Retool home page (as of version 2.107.1).

For folks using self-hosted Retool, the following query can be used to check the on-prem database for which apps use a particular resource. It can be good to save in your query library to make it easier to input the required variables:

with most_recent_saves as (
  select
  *
  from (
    select ps.*, row_number() over (partition by "pageId" order by "updatedAt" desc) as rs
    from page_saves ps
  ) ps_ranks
  where ps_ranks.rs = 1
),
resource as (
  select r.name as uuid from resources r
  left join resource_folders rf
    on r."resourceFolderId" = rf.id
  where r."displayName" = {{resource_display_name}}  -- plaintext name of the resource, must match exactly including whitespace
    and rf.name = {{resource_folder_name}}  -- plaintext name of the resource folder; if resource is not in a folder, use 'root'
),
pages_with_resource as (
  select *
  from
    most_recent_saves
  where
    cast(data as text) ilike (select concat('%', resource.uuid, '%') from resource)
)
select 
  concat(f.name, '/', p.name) as app_name
from pages_with_resource pwr
left join pages p 
  on pwr."pageId" = p.id
left join folders f
  on p."folderId" = f.id

**Note** It's not advised to make changes directly to your storage database as a lot of the values are interdependent, be super careful if you consider doing so!

1 Like

Hey folks! As of 2.116.0 you should be able to see a list of apps using any particular resource and be alerted if a resource is in use when you delete it :grin:

Beyond that, you can also order your resources to see which are most used:

If you're not seeing this already in your org, head over to the Beta tab of your settings where it can be enabled:

3 Likes