cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Databricks Alerts

NLearn
New Contributor II

Hello everyone, I have a requirement to set databricks alerts. I am struggling with email body template. I was trying to create button using custom template in html but it did not work out. Is there any sample template for alerts which can show in best format.

1 REPLY 1

szymon_dybczak
Contributor

Hi @NLearn ,

It should looks like this:

 

 

 

<table>
<tr><th>column1 header</th><th>column2 header</th></tr>
{{#QUERY_RESULT_ROWS}}
<tr>
<td>{{column1}}</td> <td>{{column2}}</td>
</tr>
{{/QUERY_RESULT_ROWS}}
</table>

 

 

If you're going to use custom template then you can use following built-in template variables:

  • ALERT_STATUS: The evaluated alert status (string).
  • ALERT_CONDITION: The alert condition operator (string).
  • ALERT_THRESHOLD: The alert threshold (string or number).
  • ALERT_COLUMN: The alert column name (string).
  • ALERT_NAME: The alert name (string).
  • ALERT_URL: The alert page URL (string).
  • QUERY_NAME: The associated query name (string).
  • QUERY_URL: The associated query page URL (string).
  • QUERY_RESULT_TABLE: The query result HTML table (string).
  • QUERY_RESULT_VALUE: The query result value (string or number).
  • QUERY_RESULT_ROWS: The query result rows (value array).
  • QUERY_RESULT_COLS: The query result columns (string array).

An example subject, for instance, could be: Alert "{{ALERT_NAME}}" changed status to {{ALERT_STATUS}}.

You can  also use HTML to format messages in a custom template. The following tags and attributes are allowed in templates:

  • Tags: <a>, <abbr>, <acronym>, <b>, <blockquote>, <body>, <br>, <code>, <div>, <em>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <head>, <hr>, <html>, <i>, <li>, <ol>, <p>, <span>, <strong>, <table>, <tbody>, <td>, <th>, <tr>, <ul>
  • Attributes: href (for <a>), title (for <a>, <abbr>, <acronym>)

 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group