cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Azure Databricks User Alerts: query_result_table

MeggieFox
New Contributor III

Hi,

How can I set up the notification email to show all of rows from query_result_table, not only first 10?

4 REPLIES 4

Kaniz_Fatma
Community Manager
Community Manager

Hi @MeggieFox , 

By default, the body of an email notification for a Databricks Job with a query result table will display the first 10 rows of the query result table. However, you can configure the notification to display all the rows by customizing the email template used for notification.

Hereโ€™s how to configure the email template:

  1. Go to your Databricks workspace and select User > Account Settings > Notifications.

  2. In the Email template section, select Custom.

  3. In the Custom template textbox, replace the existing message with the following template:

Results of query {{job_result.id}}
{% for row in job_result.result().collect() %}
{{ row }}
{% endfor %}
  1. Save your changes.

The customized email template uses a Jinja2 template that iterates through all rows in the query result table and appends them as a string. This ensures that all query rows are included in the notification email, instead of just the first 10 rows.

Now, when you run a Job with query results, the notification email will display all of the rows in the query result table.

Thank you for your reply, but it is not exactly what I thought. I use SQL alerts so dont know where should I go to put this changes written by you.

Workspace > user settings:

MeggieFox_0-1697454304078.png

 

I check 

@Kaniz_Fatma 

Can you help me with my problem? I have a workspace admin but I cannot find the path as you wrote. When I go to the Account Settings > Notifications I can only see:

MeggieFox_0-1699010772574.png

 

MeggieFox
New Contributor III

I see that my previous message has been cut. 

So, I just wanted to check where can I change email setting using the code above, because when I open  User > Account Settings > Notifications I can see only option like this:

MeggieFox_0-1697540616365.png

 

there is no place to configuration emails. 

regards,

Meggie

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!