Edit

Create an alert rule on a Fabric Warehouse SQL query

This article shows you how to create an alert on a Warehouse SQL query. When you create an alert on a SQL query, an alert is raised when the query returns results. If the query doesn't return any value, no alert is raised.

Create an alert rule

In the SQL query editor of a Warehouse SQL query, enter and run a SQL query, and then select Create rule on the ribbon.

Screenshot of the Set alert button on the ribbon.

Note

The SQL query must be a SELECT query.

Continue to the next section to start creating a rule.

Details section

On the Add rule page, in the Details section, for Rule name, enter a name for the rule.

Screenshot that shows the Add rule pane with the rule name filled.

Monitor section

  1. In the Monitor section, for Source, confirm that the source is set to the table on which you ran the query.
  2. For Query, confirm that you see the query you ran in the SQL query editor. To see the full query, select Show more.
  3. For the Run query every field, select the frequency at which the query should run to check the condition.

Screenshot of the Add rule window with the Details, Monitor, and Condition sections.

Condition section

For the Check field, confirm that On each event is selected. This setting means that the alert is evaluated every time the query runs.

Action section

In the Action section, select one of the following actions:

Email

To configure the alert to send an email when the condition is met, follow these steps:

  1. For Select action, select Send email.

  2. For To, enter the email address of the receiver or use the drop-down list to select a property whose value is an email address.

  3. For Subject, enter a subject for the email.

  4. For Headline, enter a headline for the email.

  5. For Notes, enter notes for the emails.

    Note

    When entering subject, headline, or notes, you can refer to properties in the data by typing @ or by selecting the button next to the text boxes. For example, @BikepointID.

  6. For Context, select values from the drop-down list that you want to include in the context.

    Screenshot of the Add rule pane with the Send email action selected.

Teams message

To configure the alert to send a Teams message to an individual or a group chat or a channel when the condition is met, follow these steps:

  1. For Select action, select Teams -> Message to individuals or Group chat message, or Channel post.

  2. Follow one of these steps depending on the option you selected in the previous step:

    • If you selected the Message to individuals option, enter email addresses of receivers or use the drop-down list to select a property whose value is an email address. When the condition is met, a Teams message is sent to specified individuals.
    • If you selected the Group chat message option, select a group chat from the drop-down list. When the condition is met, a message is posted to the group chat.
    • If you selected the Channel post option, select a team and a channel. When the condition is met, a message is posted in the channel.
  3. For Headline, enter a headline for the Teams message.

  4. For Notes, enter notes for the Teams message.

    Note

    When entering headline or notes, you can refer to properties in the data by typing @ or by selecting the button next to the text boxes. For example, @BikepointID.

  5. For Context, select values from the drop-down list that you want to include in the context.

    Screenshot of the Add rule pane with the Send Teams message option selected.

Run Fabric activities

An Activator rule can run a Fabric activity defined in one of the following Fabric item types:

  • Dataflow
  • Pipeline
  • Spark job
  • Notebook
  • Function
  • Copy job (preview)
  • Publish business event (preview)

To configure your rule to launch a Fabric activity, follow these steps:

  1. For Select action, select the appropriate Fabric item type within the "Run Fabric Activities" section

    Screenshot of the Run Fabric items option.

  2. On Select Fabric item to run, select the Fabric item from the list.

  3. For the Pipeline, Dataflow, Notebook, Spark job, Publish business event (preview) types, select Add parameter and specify the name of the parameter for the Fabric item and a value for it. You can add more than one parameter. The Copy job (preview) type doesn't accept parameters.

    Screenshot of the Add rule pane with parameters for a Fabric item specified.

Run function

If you select Run function, follow these steps to select the function and specify parameters for it:

  1. For Function, select a function from the list.

  2. For parameters to the function, specify values for each of the parameters defined for the function as shown in the following example:

    Screenshot of the Add rule pane with parameters for a Function specified.

    You can use properties from the data by typing @ or by selecting the button next to the text boxes. For example, @BikepointID.

Publish business event (preview)

If you select Publish business event (preview), follow these steps to select a business event schema from the schema registry, and specify parameters for it:

  1. When you select Publish business event (preview), you see the Select a business event window.

  2. In this window, select a business event schema from the list of schemas that are registered in the schema registry. You can also search for a schema by typing its name in the search box.

    Screenshot of the Select a business event window.

  3. For parameters to the business event, specify values for each of the parameters defined for the schema as shown in the following example:

Custom action

To configure the alert to call a custom action when the condition is met, follow these steps:

  1. For Select action, select Create custom action.

    Screenshot of the Action section with custom action selected.

  2. As mentioned in the Action section, create the rule first, and then complete the custom action setup by following steps from Trigger custom actions (Power Automate flows).

    Screenshot of the custom action selected.

  3. After you create the custom action, in the Definition pane of the rule, select the custom action from the Action drop-down list.

    Screenshot of the custom action selected in the Select action drop-down list.

Save location section

  1. In the Save location section, for Workspace, select the workspace where you want the Fabric activator item to be created or that already exists.

  2. For Item, select an existing activator item or create a new one. To create a new activator item, select Create a new item, and then enter a name for the activator item.

    Screenshot that shows the Add rule pane with the location for the Fabric activator item selected.

Create the rule

  1. On the Add rule page, select Create to create the rule. After the rule creation is successful, it runs based on the frequency you set in the Run query every field. If the query returns results, the rule triggers the actions you set.
  2. You see the rule in the Rules pane. You can select the rule to view its details, edit it, or delete it or open it in Activator.

Rules pane

In the Rules pane, you can perform the following tasks:

  • Use the toggle button to start or stop the rule. When the rule is stopped, it doesn't run, and no alerts are sent. Once you see a couple of sample alerts, stop the rule to avoid sending too many alerts. You can start the rule again when you want to receive alerts.

  • Use the Edit button to edit the rule without leaving the SQL query editor page. You can edit the rule's details, conditions, actions, and save location.

  • Use the Delete button to delete the rule.

  • Select View in Activator to open the rule in Activator. You can view the rule's details, edit it, or delete it in Activator. When you view in Activator, you can also see the rule's history, including when it was triggered and the alerts that were sent.

    In the Activator page, select the event name, and select Manage source to view the SQL query that triggered the alert. If you select the query link, you navigate back to the SQL query editor page.

    Screenshot of the Sample warehouse event page with a link to the sample warehouse.

Sample alert

Here's a sample alert Teams message that you receive when the alert is triggered:

Screenshot of the samples Teams alert message.