Query
Last updated: November 5, 2024
The Query feature allows you to work directly with the tables in Aleph using SQL. To do so, follow these steps:
Open the add-in
Click "Add" and then click "Query".
Select the warehouse that you would like to query data from. Integration tables and Aleph tables can be found in the Aleph Warehouse option, while data warehouse tables will be found in their respective options (e.g. Snowflake Connection).
You can start writing the SQL query from scratch, or you can click on the ellipsis and select "Start from table".
Select the desired table from the list, and Aleph will populate a basic query to use as a starting point.
Next, add the SQL code that you need for your query in the code block. You can also click on "Edit in large window" to open up a modal making it easier to edit.
Once your query is complete, you can click on the ellipsis and select "Format SQL" to clean up the format query to improve readibility.
Click on "Pull Data" and Aleph will open a new tab with the output of the query.
Any time you want to update the data or modify the query, just click on "Pull Data" to update the output.
Tip: Unlike using an Explore, writing a query will allow you to pull data from multiple tables by joining them in your SQL query.
You can also create variables in your spreadsheet and then feed that variable into a SQL query. You need to use to select the cells this way:
SELECT *
FROM public.countries
WHERE continent = {{range('E14')}}
LIMIT 100Or this way, with more than one cell:
SELECT *
FROM public.countries
WHERE continent in {{range('E14:E15')}}
LIMIT 100