Loading the documentation…

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, roles or email addresses 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 or Email addresses 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, the Timezone and Email.
  8. Open Recipients and pick Roles or People, type Email addresses, or combine them.
  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, person or email address.

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. The alert runs at its Time on every day Runs includes; schedules are checked every minute. 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.

Time and the day are read in the alert's Timezone. A new alert starts on your browser's time zone, and the field reads as a sentence, for example Runs in Tokyo time (GMT+9), the same as your clock. When the alert's time zone differs from yours, the sentence also shows the time on your own clock, for example 09:00 there is 08:00 for you., with the day before or the next day when the day differs.

To use another time zone, click Change and type a city or country. Each row shows the time there now and its offset. Before you type, Suggested lists your time zone and UTC. Changing the time zone keeps the time you typed: 09:00 stays 09:00, now read in the new zone. Editing an alert keeps the time zone it was saved with, and an alert saved before Timezone existed keeps running at the same moment, with the editor showing the time zone it uses.

The alert list's Schedule column and the details panel name the time zone, for example Daily at 09:00 Tokyo time, Sundays at 18:30 UTC or Monthly on day 31 at 09:00 UTC.

Under Schedule, Email controls when emails go out:

A failed run never sends an email.

Choose who receives it

An address that is not valid is not added and shows Enter a valid email address; one already in the list shows This address is already added. Addresses are not case-sensitive. An alert holds up to 50 addresses (Add up to 50 email addresses). DataMind sends to a typed address as it is and does not check that the mailbox exists.

You need at least one role, person or email address (Pick at least one role, person or email address). Each address receives the email once, even when a typed address is also a picked person's address. 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, read in the alert's Timezone.09:00
TimezoneThe time zone that Time and the day are read in. Click Change and search by city or country. Changing it keeps the time you typed.Your browser's time zone
Email (under Schedule)When emails go out.When it changes
Roles, People and Email addressesWho 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 alert's own Timezone, which starts on your browser's time zone for a new alert. Open the alert, then Schedule: the sentence under Timezone names the zone and, when it differs from yours, shows the time on your own clock. Click Change to pick another zone.

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.

Can I send an alert to a mail group or someone without an account?

Yes, if you hold Notify Others with Alerts. Under Recipients, type the address in Email addresses, for example the address of a distribution list, and press Enter. The address does not need a DataMind account, and the mail group delivers the email to its members.

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.