Report Builder based on Shared Query Library

I'm looking to create a report section for the end user and would appreciate other people's inputs on how they may have achieved the same.

My first thought was to use the Query Library directly.

  • Create a page in my app, add a drop down at the top of the page and populate it with a list all the queries in the Query Library, (or a subset)
  • The user then selects which one they want to run. When they do, the various parameters for that Query are loaded (just like in the Query Library itself) and the user can enter the values they want.

I know I could create an app that effectively hard codes these parameters but I would quite like to just be able to create a new query in the library and have it automatically appear in this list.

To achieve the above though I need some way of querying Retool to tell me what is in the Query Library which I can't see how to do, thought it might be in the API but not seeing it.

Has anyone else tried something similar?

Hey Ross,

Retool doesn’t currently expose the Query Library contents via API, so there’s no direct way to dynamically list or pull parameters for saved queries in the way you’re describing. The REST API docs only cover resources like apps, workflows, environments, and users — Query Library queries aren’t yet part of that surface.

If you want the “auto-appear” behavior without hardcoding parameters, the usual workaround is to:

  • Store your queries (and parameter metadata) in a database table instead of the Query Library.
  • Use your app to read from that table to populate the dropdown and build/run the query dynamically based on the stored SQL + parameters.
  • Optionally, use Retool’s JS queries or transformers to inject parameter values before execution.

This way, adding a new “library” query is just adding a row to your table — no code change in the app itself.

If you stick with the built-in Query Library, you’d need to maintain the list manually in the app, because there’s no public endpoint for programmatic access right now. Might be worth submitting a feature request to the Retool team if that’s a must-have.

Thank you David for the suggestion.

Definitely not a must-have and I'm sure I have old requests I would rather the team worked on than this. The database table suggestion is a fair workaround and probably enables better data typing anyway so I'll go with that.

Thanks

1 Like