Multi-step orchestration with Retool app?

I am trying to figure out if retool can even do (conceptually) what I am thinking about. I have been trying to design it on a high level but I am struggling with setting up proper flows.
Should each component be a separate app?
Should each component be a separate module in open app?
How to pass data async?

Step 1: Query database -> Display Result to the user
Step 2: Runs in the background after step 1: Get Result from Step 1 -> Pass it to Python or JS script (Transformer?) -> Pass output from Python or JS script to some other component -> Display output from component to user

So, basically, the user first sees results from step 1 then a few things happen with that result in the background and eventually user sees result of those background processes.

Yes,Retool can do all of these things. Have you read through the tutorials?

I have read through the tutorials and have been trying to do this for days. Python functions is available only in workflows, which require a trigger, either a webhook or schedule. I want users to open up the app and query the DB in step 1, so there is no webhook or schedule

Can you simply run a query written in SQL?

yes, I can. But how is this connected to my questions? I am not sure I follow.

Hi @k2m,

Have you trying hands on with the tutorial? Those tutorials should have answer your questions and at the very least demonstrates how to do Step 1. It should also show you how to reference results from SQL, how to reference user's input/selection in any other code blocks.

Most code blocks (SQL, JS Query, Query JSON with SQL, etc...) are async utilizing promise feature of JS.

You're correct about Python is only in Workflow at the moment. So if you don't want to use webhook then JS is the option.

For Step #2:

  1. All SQL query objects in Retool have Event Handlers. This allows you to trigger other SQLs or JS Queries, to run your process in the background after SQL in Step #1 completed

  2. as for transformer, each SQL query object has a built in transformer that you can use. Using external (outside of SQL query object) transformer, you can reference the results from SQL in step 1. Reference results from step #1 via the {{ }} syntax of which tutorials should have demo that. The transformer will automatic run whenever results from step #1 changed.