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

werners1
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

werners1
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!

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.