This guide is a short walk-through of a basic Query.me use case: The creation of a parameterized, SQL-based report that is then scheduled and sent out via email.
If you don't have a Query.me account yet, you can sign up here and create a free account.
Every new account comes with a "Welcome Notebook" and a (read-only) database connection with some demo data to tinker with.
This step is optional at this point.
You can follow the tutorial using the demo data available to any new account and come back to this step later. But of course, the experience is much better using real data.
To create your first notebook, select "New Notebook" from the menu on the home screen and then select "Blank Notebook" from the template selection.
Here's a quick primer on notebooks:
Blocks
that can be created using the
-button or the assigned hotkeys
shown in the add-block menu.pages
that can be created, browsed, and removed in the Sidebar
.Exectuted
, Sent
, and Scheduled
in the top navigation.Viewing
and an Editing
mode. You can change mode freely unless you do not have editing permission.Add Block Menu
click the +
-button next to any existing block.SQL Query
Now it's time to execute our first SQL query.
-button
-icon next to the query name.Browsing schema information:
-button copies a full select statement of the table to your clipboard.
-button lets you preview a table.OK. Now we know how to query our data using SQL.
To continue with our tutorial, try running the following SQL code against the demo database:
SELECT
date_trunc('month', orderdate) as day,
region,
sum(profit) as profit
FROM demo_data.store_orders
group by 1,2
In Query.me you can easily visualize the results of a query as a chart.
-button on the SQL block is the fastest way to create a chart directly from the result of a query.Edit
to make changes to the chart, e.g. changing the visualization type from a bar chart to an area chart.One very powerful feature of Query.me is that you can create parameters to make your notebooks more dynamic.
For example, you can create a parameter block and then use it inside a SQL query to filter for a specific product category, date, customer ID, etc.
+
-Menu and select Parameter Input
parameter_1
will be created. West
{{ parameter_1 }}
{{
button on the SQL block to render a preview of the parsed query that will be executed on run.Here is our updated SQL query with the parameter reference:
SELECT
date_trunc('month', orderdate) as day,
region,
sum(profit) as profit
FROM demo_data.store_orders
WHERE region = '{{ parameter_1 }}'
group by 1,2
You can play around with different parameter types and even create dropdown parameters by specifying a list of allowed values:
Query.me notebooks can be easily shared with your team - pretty much like a Google Doc.
Just click on the Share
-button and define your sharing settings for the notebook.
Finally, scheduling notebooks to be run regularly is very easy.
We also can receive it as an email report directly to our inbox.
Schedule
button in the top navigation bar.Select Action
you can choose to just execute the current page or to Execute + Send
it via emailSave
and you are done. This report will now send automatically at the set interval.To run it manually, click on the ...
and select Run now
:
Your inbox should now have a new message like this:
Note: You can make things a bit prettier by hiding the actual SQL and the results.
Check out the Advanced Guide for a more complex reporting pipeline using conditional statements, loops, slack messages, and more.
Or browse our examples and use them as a template for your next project.