How can i formatting result of {{QUERY_RESULT_ROWS}} in custom alerts that i can see something like table , not like rubbish?

I used custom alerts for describing result of query in body of email. The {{QUERY_RESULT_COLS}} gives no data , just names of columns in query, instead of it QUERY_RESULT_ROWS gives all needed information , but it is not readable cause there are 4 columns and all data described like one row, without order, with some “/u” and {{. And it gives nothing because finding needed information very hard process.
Could you please share with me solution how configure it like a table in query in pretty way.
Thank you in advance

From our alerts documentation:

The preview is useful for verifying that template variables get rendered correctly. It is not an accurate representation of the eventual notification content, as each alert destinations can display notifications differently.

To format the message further you’ll need to configure an Alert Destination that can perform more detailed transformations.

For example, how should i change configuration an Alert Destination for gmail emailing?

You’ll need to have a web-service that transforms Redash’s alert data into a nicely formatted email. The flow would look something like this:

How to connect to Alert result data via Python, what configuration i should use?Please give me an example

Hi viktoria,

My workaround for this is:

  1. Output a new column that contains values in all rows that you want to display in your alert using group_concat (If you are using Query Results data source). Format it as you would like to appear in slack. Something like:

(SELECT group_concat(A, ‘

FROM table) as slack_display
FROM table

And use formatting type ‘Number’

Notice that I gave a newline(using enter) in the group concat delimiter, so that new row will rendered as newline in slack

  1. Use slack_display as trigger column on your alert
  2. Use {{QUERY_RESULT_VALUE}} in your description. Note that: the description has character limitation, so it will truncate your last row to column_valu… Try to limit your data

One of my usage, to track which query that has updated or created by someone in the last 1 hour. It has hyperlink, so we can go to the specific query. You could also mention someone or @channel. Read more about slack formatting guide here

Another workaround is using Webhook Alert Destination, getting the visualization image screenshot link and post it to slack. Currently I am using google apps script to get the image screenshot and post it to slack. Something like Pulse in Metabase if you are familiar with it :slight_smile:
Example (using counter viz):

1 Like

Hello Rahi)

Thank you very much!