Get sql query of a GUI question

Hi!
I want to use Metabase as a interface for users to build its own KPIS.
But i want to extract these formulas to calculate and save them on a new table.
Users uses GUI so I need to obtain its sql translation.

When you edit a question, you can see de SQL, but how can I obtain it? is saved to any table? Theres any API or something to translate a GUI to SQL?

thanks in advance!

Anna

Metabase gives you a number of tools to save your KPI calculations with. The easiest is to save the formula into a question. If your calculation uses an aggregate, you can save it as a Metric that you can plug into future queries.

The SQL is generated on the fly. If you want to save it, copy and paste it into another document.

Technically, you can use the API (the same one the frontend uses) to retrieve the generated SQL. I’m not familiar enough with the API to tell you what the call is, though.

Thanks for your answer. I need to do it automatically since I will have hundreds of vars.
I need this API, I would look for it.