How about using session state to hold kwargs selected in the dropdown? Can’t you pass them directly as parameters?
Alternatively, put the components that are serving the app behind a FastAPI
microservice running on a separate thread.
HOST = 'localhost'
PORT = 8000
def thread_runner(app, host, port):
uvicorn.run(app, host=host, port=port)
app = FastAPI()
@app.get('/prepare_query')
def prepare_query(**kwargs):
for name, val in kwargs.items():
# build your query string here, do the work, and return response
pass
thread = threading.Thread(name='QueryServer', target=thread_runner, args=(app, HOST, PORT))
thread.start()