Skip to content

Daily

Get an alert when daily DBU spend goes over budget

If yesterday's DBU usage passed your budget, you know first thing in the morning.

Runs
Daily
Apps
Databricks
AI
Not needed
Access
system tables read + SQL warehouse

Send this to your assistant

Create a ClickRuntime automation: every morning at 8, add up yesterday's DBUs from system.billing.usage using my SQL warehouse and email me if the total is over 500.

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

Databricks spend grows in ways that are hard to see until the invoice arrives. A data engineer leaves an oversized cluster running, a notebook scheduled every hour loops over far more data than expected, and a month of quiet overspending turns into a number finance asks about. Cloud billing reports lag by a day or more.

Each day, this runs a SQL query through Databricks' statement execution API to total yesterday's DBUs, compares the result with the budget you set, and emails you if it was exceeded. You see overspend the next morning, not at month end.

Data platform owners and FinOps leads use it as a daily guardrail on Databricks consumption. The total is computed with a SQL query run through the statement execution API, so it uses your own usage data and the budget you set, not an estimate from a separate billing tool.

What you get out of it

  • Stop runaway spend within a day

    A job that burns triple the usual DBUs is spotted the next morning. Shutting it down then costs a day of overspend, not a month of it. A job burning triple the usual DBUs is spotted the next morning, so shutting it down costs a day of overspend and not a month.

  • Hold teams to a clear budget

    A daily DBU limit gives everyone the same reference. Teams adjust their usage knowing that an overrun will be noticed. A single daily limit gives every team the same reference, and they adjust their usage knowing an overrun will be noticed.

  • Trace the job behind the jump

    If yesterday's usage jumped, the responsible job or cluster is easy to trace. The longer you wait, the harder the investigation becomes. If yesterday's usage jumped, the responsible job or cluster is easy to trace, and the trail goes cold quickly.

  • Give finance early warning

    Finance learns about overspend before invoices arrive. That allows them to adjust forecasts instead of explaining a surprise to executives. Finance learns about overspend before invoices arrive, and can adjust forecasts instead of explaining a surprise.

  • Support cost reviews with real data

    Each alert records a day when usage passed the budget. Those entries are helpful when reviewing which workloads cost the most. Each alert records a day when usage passed the budget, which helps when you review which workloads cost the most.

How it works

What happens, step by step

  1. Every morning, ClickRuntime asks Databricks how many DBUs your workspace used yesterday.

  2. It compares that total with the daily budget you set.

  3. If yesterday went over, you get an email with the usage and your limit.

Before it runs live

  • Connect Databricks

What you get

RunsDaily
Get an alert when daily DBU spend goes over budgettoday, 9:00Succeeded
Email · Databricks DBUs over 500 yesterdayYesterday's usage: 642.8 DBUs (limit 500).

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 Databricks 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.
daily_dbu_cost_alert.pyexample
from clickruntime import on_trigger, credentials, http, notify

HOST = "https://dbc-a1b2c3d4-e5f6.cloud.databricks.com"
WAREHOUSE_ID = "1234567890abcdef"
LIMIT = 500

@on_trigger
def run(event):
    resp = http.post(f"{HOST}/api/2.0/sql/statements",
                     headers={"Authorization": f"Bearer {credentials.secret('DATABRICKS_TOKEN')}"},
                     json={"warehouse_id": WAREHOUSE_ID, "wait_timeout": "30s",
                           "statement": "SELECT SUM(usage_quantity) FROM system.billing.usage "
                                        "WHERE usage_unit = 'DBU' AND usage_date = current_date() - 1"})
    resp.raise_for_status()
    total = float(resp.json()["result"]["data_array"][0][0] or 0)
    if total > LIMIT:
        notify.email_me("Databricks DBUs over 500 yesterday", f"Yesterday's usage: {total:,.1f} DBUs (limit {LIMIT}).")
    return {"dbus": total}

FAQ

Common questions

Where does the DBU figure come from?
It runs a SQL query against Databricks system tables on a SQL warehouse using the statement execution API. System billing tables must be enabled in your workspace for usage to be available. The query reads Databricks system tables on a SQL warehouse, and the billing system tables must be enabled for usage to be available.
Does it need a running SQL warehouse?
Yes, the query needs a warehouse to run on. A small serverless or pro warehouse is typical, and its short run time costs very little compared with the usage it monitors. A SQL warehouse runs the query, and a small one is usually enough, so its cost is tiny compared with the usage it watches.
Can I set different budgets per workspace?
Yes. Give your AI assistant the budget for each workspace and the query and comparison can be extended. The revised logic is shown for approval before the change takes effect. Giving each workspace its own budget extends the query and comparison.
What permissions does it need?
system tables read + SQL warehouse. 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 “Get an alert when daily DBU spend goes over budget” from your assistant

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