SQL Query
Overview
The SQL query step lets you build a recipe from one SQL query instead of
visual steps. If you already know the query you need, you write it directly. You can use
CASE, subqueries and UNION ALL, and preview the result right away.
Recipes run on ClickHouse, so the query uses ClickHouse SQL. Table and column names are case-sensitive.
Add a SQL query step
- Open a recipe and click + to add a step.
- In the Custom SQL section, select SQL query.
- Write the query in the editor. The step opens empty, and Run and Save stays unavailable until you enter a query.
- Press Cmd/Ctrl + Enter to preview the result.
- Click Run and Save to update the recipe table.
Write the query
The editor highlights SQL syntax and shows line numbers. It helps you as you type:
- Autocomplete. The editor suggests ClickHouse keywords and functions. It
also suggests the tables in your workspace with their readable titles, the columns of the
tables you use, and
table.columnnames. - Format. Click Format or press Shift + Option + F (Shift + Alt + F on Windows) to clean up the layout of the query. Formatting keeps the case of table and column names.
- Undo. Cmd/Ctrl + Z inside the editor undoes your last text change.
Find tables and columns
The panel on the right lists every table in the workspace.
- Search for a table by name.
- Expand a table to see its columns and their types.
- Click + next to a table or column, or drag it into the query.
- Tables that the query already uses are marked in query.
- Hide the panel when you need more room. The editor remembers your choice.
One approach per recipe
A recipe uses either visual steps or a single SQL query step, never both. This keeps the recipe easy to read for the next person who opens it.
- In a recipe with a SQL query step, you cannot add Blend, Join, Filter or Group by steps, a second SQL step, or the Currency Conversion and Naming Convention steps. A tooltip on each card explains why. Data QA and Load stay available.
- In a recipe with visual steps, the SQL query card is unavailable.
SQL steps that the AI Agent created earlier also open in this editor. You can edit them the same way.
Was this article helpful?
Thanks for the feedback!
Questions? The Improvado team is always happy to help. Send us an email, contact your Customer Success Manager, or raise a request in the Improvado Service Desk.