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.
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
Every morning, ClickRuntime runs your saved Snowflake query, for example yesterday's revenue by region.
It formats the rows that come back as a simple table, with a total where it makes sense.
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
Build your own
Need it to work differently?
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
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?
How is the result formatted in the email?
Which Snowflake warehouse does the query use?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Get an email when a warehouse uses too many credits
Each morning you learn which warehouses used more than your limit in the last 24 hours.
See how it worksGet a Slack alert when a table gets no new rows
If today's load hasn't arrived by 9am, your data channel hears about it once.
See how it worksKnow the moment your website goes down
Your team hears in Slack when the site stops responding or slows down, and again when it's back.
See how it worksKeep exploring
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.