Skip to content

Daily

Email a KPI query's results every morning

The numbers you'd otherwise open Snowsight for arrive as a table in your inbox.

Runs
Daily
Apps
Snowflake
AI
Not needed
Access
read on target tables

Send this to your assistant

Create a ClickRuntime automation: every weekday at 8am, run this SQL in Snowflake: SELECT region, SUM(revenue) FROM ANALYTICS.SALES.DAILY WHERE day = CURRENT_DATE - 1 GROUP BY region, and email me the result table.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A team lead needs the same handful of numbers every morning: yesterday's signups, active accounts, revenue, support backlog. They live in a Snowflake query that an analyst once wrote. Running it means opening a worksheet, finding the saved SQL, executing it, copying the results into an email and sending it, or telling someone to do it. When the analyst is out, the numbers stop. When the query is edited, nobody knows which version the last report used.

Each morning, ClickRuntime runs your SQL statement against Snowflake, formats the returned rows into a readable table and emails it to the people on your list. The query is stored with the automation, so everyone receives results from the same version of the logic at the same time.

It suits KPI summaries, daily operational counts and any recurring question you currently answer by hand with SQL.

What you get out of it

  • Decisions start with fresh numbers

    Leaders read the same figures at the same time every day, which means meetings start from shared facts and not from an argument about whose export is current. A shared daily baseline also makes trends easier to spot and explain to others.

  • Results do not depend on one analyst

    The report arrives on holidays and sick days. Analysts are freed from running the same query repeatedly and can spend their time on new questions. The team gets steady reporting, and the analyst gets uninterrupted time for deeper analysis.

  • The logic is defined once

    Because the SQL lives in one place, the definition of an active account or revenue stays consistent from day to day, instead of drifting across copied queries. Disagreements about the numbers can be resolved by reading one query, not by comparing spreadsheets.

  • Stakeholders do not need Snowflake access

    Executives and partners receive the output by email without licenses or training, which keeps warehouse permissions tight while still sharing the results. Fewer people holding warehouse credentials is also better security practice.

  • A history of results accumulates

    Each morning's email is a dated snapshot. Months later, you can check what the number was on a particular day, even if the underlying table has since been corrected. It also shows how the metric behaved before any later data fixes or schema changes.

How it works

What happens, step by step

  1. Every morning, ClickRuntime runs your saved Snowflake query, for example yesterday's revenue by region.

  2. It formats the rows that come back as a simple table, with a total where it makes sense.

  3. The table lands in your inbox, so you don't need to open Snowsight to see the numbers.

Before it runs live

  • Connect Snowflake

What you get

RunsDaily
Email a KPI query's results every morningtoday, 9:00Succeeded
Email · Yesterday's revenue by regionEMEA $48,210.00 North America $91,604.50 Total $139,814.50

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Run it at a different time, more or less often, or only on weekdays
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other Snowflake steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
scheduled_query_result_report.pyexample
from clickruntime import on_trigger, credentials, http, notify

ACCOUNT = "myorg-myaccount"
WAREHOUSE = "REPORTING_WH"
QUERY = ("SELECT region, SUM(revenue) FROM ANALYTICS.SALES.DAILY "
         "WHERE day = CURRENT_DATE - 1 GROUP BY region ORDER BY 2 DESC")

def sql(statement):
    resp = http.post(f"https://{ACCOUNT}.snowflakecomputing.com/api/v2/statements",
                     headers={"Authorization": f"Bearer {credentials.secret('SNOWFLAKE_PAT')}",
                              "X-Snowflake-Authorization-Token-Type": "PROGRAMMATIC_ACCESS_TOKEN"},
                     json={"statement": statement, "warehouse": WAREHOUSE, "timeout": 60})
    resp.raise_for_status()
    return resp.json()["data"]

@on_trigger
def run(event):
    rows = sql(QUERY)
    lines = [f"{region:<16} ${float(rev):>12,.2f}" for region, rev in rows]
    total = sum(float(rev) for _, rev in rows)
    notify.email_me("Yesterday's revenue by region",
                    "\n".join(lines) + f"\n{'Total':<16} ${total:>12,.2f}")
    return {"rows": len(rows)}

FAQ

Common questions

Which kinds of queries can it run?
Any SELECT statement that returns rows, such as aggregations over orders, signups or tickets. Keep results to a manageable size, since a table of ten thousand rows is hard to read in an email body.
How is the result formatted in the email?
Rows appear as a simple table with your column names as headings. Numbers can be rounded or formatted as currency in the SQL, and the subject line can include the date so each day's email is easy to find.
Which Snowflake warehouse does the query use?
It uses the warehouse you specify for the connection. A small warehouse is usually enough for a KPI query, and setting auto-suspend keeps credits low because the warehouse only runs for the seconds the query needs.
What permissions does it need?
read on target tables. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it runs (daily). Checks that find nothing to do and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Email a KPI query's results every morning” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.