Create an alert

An alert is a SQL query that runs on a schedule and emails people when its conditions are met. Create one when people need to hear about a change in your data without opening the Editor themselves.

Check your permissions

To create an alert that emails only you, you need Create Alerts, which the Alert Creator preset includes. To add other people or roles as recipients, you also need Notify Others With Alerts, which the Alert Manager preset includes. See Permission reference for every preset.

Either permission shows the New alert button. Without Notify Others With Alerts, the Recipients card has no Roles field and People lists only you; the card reads You can only send alerts to yourself. Ask an administrator for "Notify Others With Alerts" to add others.

You cannot create or change an alert while you are viewing DataMind OS as another user. See Impersonate a user.

Create an alert

  1. Open Observability > Alerts and click New alert. Or, in the Editor, click the bell icon with the tooltip Create an alert from this query to open a new alert with your query already in it.
  2. Type a Name of up to 255 characters and pick a role in Runs as.
  3. Write the SQL in Query.
  4. Click Test at the top of the query editor, or press Ctrl+Enter in the query. The bar under the query shows a verdict (Would trigger, Would not trigger or No rules to evaluate), the number of rows returned, View rows and Preview email.
  5. Open Conditions and choose a Trigger. See the next section.
  6. Click Test again to see the value each rule produced.
  7. Open Schedule and set Runs, the Day or Day of month if asked, the Time, and Email.
  8. Open Recipients and pick Roles, People, or both.
  9. Open Email and set Subject, Note above the table, Rows, Columns and the attachment.
  10. Optionally add a Description, then click Create alert. On a saved alert, the button reads Save.
Tip

Write and check the query in the Editor first. See Write and check SQL.

Runs as is the role whose access the query uses. The list shows the roles you hold, or every role if you hold the admin role. Changing Runs as on a saved alert needs the new role as well.

Test runs the query with the access of the role in Runs as. It saves nothing and emails no one. Saving runs the same checks as Test. A new alert shows Pending until its first run. Preview email opens the exact email the alert would send; after you edit the draft, the preview is out of date until you run Test again.

A card that hides a problem is marked Needs attention: open it to see the message under the field, for example Name is required or Pick at least one role or person.

Clicking outside the editor does not close it, so a half-written query is safe. Close the editor with Cancel or the close button. If the alert in the address no longer exists, the editor shows Alert not found with Back to alerts.

Set when the alert triggers

Trigger has two modes:

In a rule-based alert, click Add rule. A new rule starts as Rows matching with Any. Each rule has one of these kinds:

Rule kindWhat it checks
Row countThe number of rows the query returns, for example greater than 100.
AggregateFirst value of, Minimum of, Maximum of, Sum of, Average of or Distinct count of a column, compared with a value.
Rows matchingWhether Any, No or Every row has a column that meets a condition.
AlwaysEvery run counts as a match.

The conditions you can pick depend on the column's type:

Enter dates as YYYY-MM-DD. Before your first Test, the editor offers every condition, and you type the column name yourself. After Test, you pick the column from a list of the query's columns. A rule that needs no value hides its Value box: Always, is empty (NULL) and is not empty.

With two or more rules, Trigger when appears. All rules triggers when every rule matches. Any rule triggers when at least one matches. After Test, each rule shows its value and a tick or a cross.

A rule-based alert needs at least one rule before you can save it. With no rules yet, the section reads No rules yet. Add one to say when the alert should trigger. If you switch it back to Query based, its rules are kept but not applied.

Set the schedule and when emails go out

Runs is Daily, Weekdays, Weekly or Monthly. Weekly asks for a Day, from Monday to Sunday. Monthly asks for a Day of month, from 1 to 31. Shorter months run on their last day. A time that is not a valid 24-hour value shows Use a 24-hour HH:mm time, and a monthly day outside 1 to 31 shows Pick a day from 1 to 31.

Alerts run on the server's clock, not on your browser's. The editor shows the current server time under the time picker.

Under Schedule, Email controls when emails go out:

A failed run never sends an email.

Choose who receives it

You need at least one role or person (Pick at least one role or person). Each address receives the email once. Deactivated users are skipped, and a deactivated role reaches nobody.

Shape the email

Until you run Test, the Columns field is disabled and every column is used. An empty subject is refused with The email needs a subject, and a row limit outside 1 to 100 with Show between 1 and 100 rows.

Settings and defaults

SettingWhat it doesDefault
NameNames the alert in the list and in its attachment.Empty, required
Runs asThe role whose access the query uses.Empty, required
TriggerQuery based or Rule based.Query based
Trigger whenAll rules or Any rule, shown with two or more rules.All rules
RunsHow often the alert runs.Daily
Day or Day of monthThe weekday for a weekly alert, or the day for a monthly one.Monday, or 1
TimeThe time of day, in 24-hour format, on the server's clock.09:00
Email (under Schedule)When emails go out.When it changes
Roles and PeopleWho receives the email.Empty, at least one required
SubjectThe email subject.[{{status}}] {{alert_name}}
Note above the tableText above the rows.Empty
RowsWhether the email includes a table.Include rows
Row limitThe number of rows in the table.10
Which rowsMatching rows or First rows, rule-based alerts only.Matching rows
ColumnsThe columns in the table.Every column
Attach the rows as a fileThe attachment type.No file

Limits and edge cases

Questions, answered

Why does the alert run as a role and not as me?

So it keeps working after its author leaves. The query uses the role's access, not yours.

Why does Test refuse a query that reads other data?

An alert can read only the Lake and Warehouse data of its Runs as role. Ask an administrator to add you to the role that owns those tables, or change the query so it reads only that role's data.

Why can't I find the role I need in Runs as?

The list shows only roles you hold. Ask an administrator to add you to the role, or ask them to create the alert.

What is the difference between Query based and Rule based?

Query based triggers whenever the query returns at least one row. Rule based triggers only when your rules match, for example a Row count greater than 100.

Why does the Column field say "Column (run Test to pick)"?

The column list fills from your last Test. Click Test first, or type the column name.

Will I get an email every day while the problem lasts?

Only with Every match. With When it changes, you get one email when the condition starts being met and one when it is back to normal.

What time zone does an alert schedule use?

The server's clock. The editor shows the current server time under the time picker.

Can I send an alert to a whole team?

Yes, if you hold Notify Others With Alerts. Pick the team's role in Roles. Everyone in that role when the email goes out receives it.

Does Test send an email?

No. Test runs the query and shows the verdict. Preview email shows the exact email the alert would send. Nothing is sent and nothing is saved.

What happens if I pick day 31 for a monthly alert?

The alert runs on that month's last day instead. Day 31 runs on 28 February, or 29 February in a leap year.

I edited the alert after a Test. What happens to the result?

The bar reads Changed since this test - run it again and hides the rule results, and an open Preview email is out of date. Run Test again to refresh both.