Daily
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.
- Runs
- Daily
- Apps
- Snowflake
- AI
- Not needed
- Access
- role with ACCOUNT_USAGE read
Send this to your assistant
Create a ClickRuntime automation: every morning at 7, check Snowflake warehouse credit usage for the last 24 hours and email me any warehouse that used more than 10 credits.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Snowflake bills by the credit, and a warehouse that is left running or hit by a runaway query can burn through a month's budget in days. A new dashboard refreshes every minute, an analyst starts a large query on a Friday, a task loops, and nobody sees the cost until the invoice or the monthly review. By then the money is spent, and the finance team wants an explanation that nobody can give, because nobody was watching usage at the time.
Each day, ClickRuntime runs a SQL query against WAREHOUSE_METERING_HISTORY, sums credits per warehouse for the previous day, keeps those above your limit, such as 10 credits, and emails you the warehouse names and totals. If every warehouse stays within budget, no email is sent.
Data platform owners, finance partners and analysts who own a warehouse can use it as a basic budget guard.
What you get out of it
Overspend is caught the next morning
A daily check turns a month-end surprise into a morning email, so a runaway warehouse is stopped after a day instead of after three weeks of expensive compute. The saving on a single runaway warehouse can easily exceed what months of monitoring would cost in effort.
Unexpected jobs are traced early
Knowing which warehouse spiked narrows the search to a handful of queries and users, so the cause can be found while people still remember what they ran. Query history for that day is still fresh and has not yet aged out of the interface.
Budgets become manageable
A per-warehouse daily limit makes a monthly credit budget concrete. Teams see how close they are running, and can make decisions before the invoice arrives. Planning the next quarter's spend then rests on real daily patterns.
Quiet days produce no noise
Because mail is sent only when a warehouse crosses the limit, the alert is a signal instead of a daily report that people learn to ignore. People keep reading it because it only appears when action is needed.
Finance conversations are better informed
With dated alerts showing which warehouse used how many credits on which day, a finance partner can ask specific questions rather than just asking why the bill was high. Cost discussions then move from blame to concrete fixes.
How it works
What happens, step by step
Every morning, ClickRuntime asks Snowflake how many credits each warehouse used in the last 24 hours.
It keeps only the warehouses that went over the limit you set.
If any did, you get an email listing each one with the credits it used.
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 = "ADMIN_WH"
LIMIT = 10
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("SELECT warehouse_name, SUM(credits_used) FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY "
"WHERE start_time >= DATEADD(hour, -24, CURRENT_TIMESTAMP()) GROUP BY 1 ORDER BY 2 DESC")
over = [(name, float(credits)) for name, credits in rows if float(credits) > LIMIT]
if over:
notify.email_me("Snowflake warehouses over 10 credits",
"\n".join(f"{n}: {c:.1f} credits in the last 24h" for n, c in over))
return {"over": len(over)}FAQ
Common questions
Where does the usage data come from?
What Snowflake permissions are needed?
Can the limit differ per warehouse?
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
Email a KPI query's results every morning
The numbers you'd otherwise open Snowsight for arrive as a table in your inbox.
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 “Get an email when a warehouse uses too many credits” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.