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: 

Query data not showing in custom alert notifications and QUERY_RESULT_ROWS

Julie1
New Contributor II

I've set up a custom alert notification for one of my Databricks SQL queries, and it triggers correctly, but I'm not able to get the actual results of the query to appear in the notification email. I've followed the example/template in the custom alert documentation, but {{QUERY_RESULT_ROWS}} and {{QUERY_RESULT_COLS}} don't seem to deliver any usable data.

Could someone assist with the phrasing of this alert notification? Am I using the handlebar formatting incorrectly? I would like the email to show the results of the triggered query, and it sounds from the documentation like it should be possible.

Notification code:

# of results:<br/>
{{QUERY_RESULT_VALUE}}<br/><br/>
 
Query result rows:<br/>
{{QUERY_RESULT_ROWS}}<br/><br/>
 
Query result cols:<br/>
{{QUERY_RESULT_COLS}}

Output in email:

"# of results:

1

Query result rows:

[{'column_7627b0db': 1}]

Query result cols:

[{'name': 'column_7627b0db', 'friendly_name': 'column_7627b0db', 'type': 'integer'}]"

1 ACCEPTED SOLUTION

Accepted Solutions

-werners-
Esteemed Contributor III

The actual query results are not displayed in the alert unfortunately. You can pass the alert condition etc, but not the raw results of the underlying query.

I hope this will be added in the future.

A workaround is to add a link to the query, so the receiver of the alert can click the link and execute the query. Not ideal, but something.

View solution in original post

2 REPLIES 2

-werners-
Esteemed Contributor III

The actual query results are not displayed in the alert unfortunately. You can pass the alert condition etc, but not the raw results of the underlying query.

I hope this will be added in the future.

A workaround is to add a link to the query, so the receiver of the alert can click the link and execute the query. Not ideal, but something.

Julie1
New Contributor II

Thanks so much -- was afraid that might be the answer, but good to know I'm not missing something!

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