PushMetrics comes with a powerful SQL editor that allows querying almost any SQL database.
Query results data can be used in other tasks.
The SQL Editor has the following inputs:
{{ parameter_1 }}
In the left sidebar, you can explore the database's contents like schemas, tables, and columns - making it easier to develop your SQL queries.
When hovering over a table name, you can also preview 100 rows of any table and copy a SELECT *
statement to your clipboard.
To execute a query, simply hit the Play button or use the keyboard shortcut ⌘ + enter
.
You can create dynamic queries using Jinja templating syntax.
This is useful to parameterize queries, use loops or if/else statements in your SQL statements.
You can easily preview the rendered query by clicking on the {{
button:
Query results are displayed below the SQL Editor.
</>
PushMetrics has a useful feature that keeps a history of your last query runs, so you can compare results between multiple run easily.
You can use both the query statement and the results data in other tasks.
Function | Description | Example Usage | Example Output |
---|---|---|---|
query_name | returns the query as a string | {{ query_1 }} |
SELECT * FROM my_table |
.data | returns the most recent query result as a dictionary | {{ query_1.data }} |
[{'category': 'Furniture', 'city': 'Henderson', 'country': 'United States'}, {'category': 'Furniture', 'city': 'Henderson', 'country': 'United States'}] |
.data[row_index] | returns a single row of the most recent query result | {{ query_1.data[0] }} |
{'category': 'Furniture', 'city': 'Henderson', 'country': 'United States'} |
.data[row_index].column_name | returns a single cell value of the most recent query result | {{ query_1.data[0].category }} |
Furniture |