Is it possible to have an alert when a row is added to a table?

DBX123
New Contributor

I currently have a table that periodically adds rows in (sometimes daily, sometimes over a month). I was hoping to have an alert for when a row is added into this. The table has date fields of when rows are loaded in.

I have an alert working, but it just runs and prints the table every day. I was hoping I could do this so that I would only get an email alert if there is a new row.

Any ideas?

Thanks 🙂

Walter_C
Databricks Employee
Databricks Employee

You could set your alert with query as:

-- Custom alert to monitor for new rows added to a table
SELECT COUNT(*) AS new_rows
FROM your_table
WHERE event_time > current_timestamp() - interval '1' hour

In this example, the query checks for rows added to your_table within the last hour. If the query returns a non-zero count, the alert will be triggered.