FFastero

Connect any database. Ask in plain English.

Try free
Back to blog

Blog article

How to Set Up SQL Alerts Without an Engineering Team

Revenue drops, churn spikes, inventory hits zero — you need to know immediately. Here is how data teams set up SQL-based alerts using Metabase, Grafana, dbt, or AI without waiting on engineering.

Fastero Dev TeamFastero Dev Team
2026-08-21
sqlalertsmonitoringmetabasegrafana
How to Set Up SQL Alerts Without an Engineering Team

You don't need an engineering team to monitor your business metrics. If you can write a SQL query that detects the condition you care about — revenue below a threshold, churn above a rate, inventory at zero — you can wire that query into an alert that fires on a schedule and hits Slack or email. The tools below range from open-source BI platforms to AI-powered agents, and every one of them works without touching your application code.

Here's what the architecture looks like, regardless of which tool you pick:

┌──────────────┐     ┌──────────────┐     ┌──────────────┐     ┌──────────────┐
│              │     │              │     │              │     │              │
│   Database   │────>│  SQL Query   │────>│  Threshold   │────>│ Notification │
│  (Postgres,  │     │  (scheduled) │     │    Check     │     │   Channel    │
│  BigQuery,   │     │              │     │  value > X?  │     │ (Slack, email│
│  Snowflake)  │     │              │     │  row count?  │     │  PagerDuty)  │
│              │     │              │     │              │     │              │
└──────────────┘     └──────────────┘     └──────────────┘     └──────────────┘
       │                                                              │
       └──────────────── runs on schedule (5min / hourly / daily) ────┘

Every approach in this post follows that pattern. The differences are in how much setup you do, how much SQL you write, and how much you manage yourself.

1. Metabase Alerts

Metabase is the fastest path if you already have it running. Any saved question can become an alert — you pick a threshold, choose email or Slack, and you're done.

Setup in 3 steps:

  1. Write a question (SQL or visual query) that returns the metric you want to monitor. For revenue drop detection, something like:
SELECT
  date_trunc('day', created_at) AS day,
  SUM(amount_cents) / 100.0 AS daily_revenue
FROM payments
WHERE created_at > now() - interval '2 days'
  AND status = 'succeeded'
GROUP BY 1
ORDER BY 1 DESC
LIMIT 2
  1. Save the question, click the bell icon, and set a condition: "Alert me when the result is below $X" or "when the number of rows is above Y."

  2. Pick recipients. Metabase sends email natively and Slack via its Slack integration.

Tradeoffs: Metabase alerts are threshold-based only — you can't do percentage-change comparisons or multi-condition logic within a single alert. If you need "revenue dropped more than 15% compared to the same day last week," you have to bake that comparison into your SQL and return a single value that Metabase can threshold on. That's doable, but it pushes complexity into the query.

Self-hosted Metabase is free. Cloud starts at $85/month. If you're already running Metabase for dashboards (and many teams are — see our open-source dashboard tools roundup), adding alerts is a five-minute job.

2. Grafana Alerting

Grafana's alerting engine is significantly more powerful than Metabase's, and it's fully free on the self-hosted OSS edition.

You define alert rules that run SQL queries against any supported data source — Postgres, MySQL, ClickHouse, BigQuery, dozens of others. The query runs on a schedule (every 1 minute, 5 minutes, whatever you set), and Grafana evaluates the result against conditions you define.

What makes Grafana different: Multi-condition alerts. You can combine expressions — "revenue is below $5,000 AND support tickets are above 50" — using Grafana's math and reduce expressions. You can also set evaluation windows, so a condition has to be true for N consecutive evaluations before firing.

Contact points cover everything: Slack, email, PagerDuty, OpsGenie, webhooks, Microsoft Teams, Discord, Telegram. Notification policies let you route different alerts to different channels.

Setup:

  1. Add your database as a data source.
  2. Create a new alert rule. Write the SQL query. Apply a reduce expression (last, mean, max) to get a single value.
  3. Set the threshold condition.
  4. Assign a contact point.

The learning curve is steeper than Metabase — Grafana's alerting UI has multiple panels, and the expression/reduce step trips people up the first time. But once you've built one alert, the second takes two minutes. For a deeper comparison, see Grafana vs Metabase.

Fastero

Connect your database. Ask questions. Get dashboards.

Postgres, BigQuery, Snowflake, and 10+ sources — live-connected, AI-powered, no dashboard builder learning curve.

Try free →

3. dbt + Elementary

If your team runs dbt, this is the approach that fits most naturally into your existing workflow.

Elementary adds data observability on top of dbt: anomaly detection, schema change alerts, freshness monitoring, and test failure notifications. It works by adding Elementary's dbt package to your project and running it alongside your regular dbt builds.

What it monitors:

  • Freshness: "This table hasn't been updated in 6 hours" — catches broken pipelines before anyone notices stale dashboards.
  • Schema changes: A column was dropped, a type changed, a new column appeared. These break downstream queries silently.
  • Anomaly detection: Row counts, column distributions, null rates that deviate from historical patterns.
  • dbt test failures: Any test you've written — not_null, unique, custom tests — gets surfaced as an alert.

Setup: Add elementary-data to your packages.yml, run dbt deps, configure the alert destination in your Elementary profile, and schedule it via dbt Cloud or your orchestrator (Airflow, Dagster, GitHub Actions).

This isn't a general-purpose "alert me when revenue drops" tool. It's a data quality tool. If the problem you're solving is "I need to know when my data pipeline breaks or my data drifts," Elementary is the right pick. If the problem is "I need to know when a business metric crosses a threshold," use one of the other tools here.

4. Lightdash Alerts

Lightdash is dbt-native BI — it reads your dbt models and metrics and turns them into a query layer. Its scheduled deliveries include threshold conditions, which makes it a decent alerting tool for teams already using dbt.

You build a chart in Lightdash, schedule a delivery, and add a condition: "Only send if value is above/below X." Delivery goes to Slack or email.

The advantage over Metabase: Lightdash inherits your dbt model definitions, so metrics are consistent between your dbt project and your alerts. No copy-pasting SQL into a BI tool.

The disadvantage: Lightdash's alerting is simpler than both Metabase and Grafana. No multi-condition rules, no evaluation windows. It's essentially "run this on a schedule, skip the notification if the condition isn't met."

If your team is already dbt-native, Lightdash keeps everything in one stack. If you're not on dbt, there's no reason to adopt Lightdash just for alerting.

5. SQL-based monitoring services

A few tools approach this from the data observability angle:

Monte Carlo monitors data quality across your warehouse — freshness, volume, schema, distribution anomalies. It's not a "write SQL, set threshold" tool; it's an ML-driven system that learns your data's normal patterns and alerts on deviations. Powerful, but expensive (enterprise pricing) and overkill if you just need "tell me when revenue drops."

Datafold focuses on data diffing — comparing query results across environments or time periods. Useful for catching regressions in pipelines.

Custom scripts + cron remains a valid option for small teams. Here's a pattern I've used for anomaly detection:

-- Detect day-over-day revenue drop greater than 20%
WITH daily AS (
  SELECT
    date_trunc('day', created_at) AS day,
    SUM(amount_cents) / 100.0 AS revenue
  FROM payments
  WHERE status = 'succeeded'
    AND created_at > now() - interval '3 days'
  GROUP BY 1
),
comparison AS (
  SELECT
    day,
    revenue,
    LAG(revenue) OVER (ORDER BY day) AS prev_day_revenue
  FROM daily
)
SELECT
  day,
  revenue,
  prev_day_revenue,
  ROUND((1 - revenue / NULLIF(prev_day_revenue, 0)) * 100, 1) AS pct_drop
FROM comparison
WHERE revenue < prev_day_revenue * 0.8
ORDER BY day DESC

Wrap that in a Python script, run it on a cron schedule, and fire a Slack webhook if it returns rows. It works, but you're on the hook for maintaining it — retries, connection handling, error reporting, and the inevitable "the script stopped running three weeks ago and nobody noticed" problem. Our SQL editors roundup covers tools for writing and testing queries like this before you deploy them.

6. Fastero — describe the alert, skip the SQL

Every approach above has the same starting requirement: you write the SQL. For teams without strong SQL skills, or teams that just want to move faster, there's a different path.

With Fastero, you connect your database and describe the alert in plain English: "Notify me on Slack if daily revenue drops more than 15% compared to the same weekday last week." Fastero's AI agent writes the SQL, validates it against your schema, sets up the schedule, and delivers to Slack or email.

The architecture is the same — query, threshold, notification — but you skip the part where you write and maintain the query. If your schema changes, you update the description and Fastero regenerates the query.

┌─────────────────┐     ┌───────────────┐     ┌───────────────┐
│                 │     │               │     │               │
│  "Alert me if   │────>│  Fastero AI   │────>│  Scheduled    │
│   revenue drops │     │  generates    │     │  SQL check +  │
│   15% vs last   │     │  + validates  │     │  Slack/email  │
│   week"         │     │  SQL query    │     │  notification │
│                 │     │               │     │               │
└─────────────────┘     └───────────────┘     └───────────────┘

This works well for teams where the data analyst knows what they want to monitor but doesn't want to maintain a folder of SQL scripts and cron jobs. It also works for non-technical stakeholders who can describe a business condition but can't write the query.

When to build custom vs. use a tool

A cron script is the right call when:

  • You have 1-3 alerts and a developer to maintain them
  • The alert logic is highly custom (multiple database queries, external API calls, complex business rules)
  • You need full control over retry behavior and error handling

A tool is the right call when:

  • You have more than 3 alerts, or you expect the number to grow
  • Multiple people need to create and manage alerts
  • You want visibility into alert history — when it fired, what the value was, whether it was acknowledged
  • Silent failures are unacceptable (a tool tracks execution status; a cron script doesn't unless you build that too)

Most teams I've worked with start with the cron script, hit the maintenance wall around alert number five, and migrate to a tool. If you can see that wall coming, skip the cron phase. For building the rest of the stack around your alerts, check out how to build a free analytics stack with open-source tools.

FAQ

Can I set up SQL alerts without writing any code? Yes. Metabase and Lightdash let you build alerts using their visual query builders — no SQL required. Fastero goes further: you describe the alert condition in plain English, and it generates and schedules the query for you.

What databases work with these tools? Postgres, MySQL, BigQuery, Snowflake, Redshift, and ClickHouse are supported by all the tools listed here. Grafana has the widest data source support — over 50 connectors. Metabase covers most common databases. Fastero connects to any database with a standard connection string.

How often should I check alert conditions? It depends on the metric. Revenue and payment failures: every 15-60 minutes. Churn and conversion rates: daily. Data freshness: every hour. Inventory levels: every 5-15 minutes if you're in e-commerce. Start with a longer interval and shorten it if you find you're catching problems too late.

Will SQL alerts slow down my production database? They can, if you're running expensive queries on your primary instance every few minutes. Best practice: point alerts at a read replica, a data warehouse, or a materialized view. Every tool listed here lets you configure a separate connection for alert queries.

What's the difference between data quality alerts and business metric alerts? Data quality alerts (dbt + Elementary, Monte Carlo) tell you when your data is wrong — stale tables, schema changes, anomalous row counts. Business metric alerts tell you when your data is correct but the business situation changed — revenue dropped, churn spiked, inventory ran out. Most teams need both, and they use different tools for each.


Try Fastero free — describe the alert in English, Fastero writes the SQL and monitors your database. Slack and email notifications built in. No credit card required.

Ready to try it yourself?

Connect your database, ask questions in plain English, and get live dashboards — in under 2 minutes. No credit card required.