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!

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!