1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How to customise an Databricks error notification email?

Discussão em 'Python' iniciado por Stack, Novembro 28, 2025.

  1. Stack

    Stack Membro Participativo

    Let's say I set up a job in Databricks. This job runs a notebook with some Python code in it; the code performs a check, and raises an error under certain conditions:

    x = -1
    if x < 0:
    raise Exception("My error message")


    I then set the job to send me an email notification on failure.

    Here is my question: how can I make the error message ("My error message" in the example above) appear in the body of the email?

    The syntax above causes the job to fail, but the error message does not appear in the email. I have also tried using the following, but it doesn't cause the job to fail:

    x = -1
    if x < 0:
    dbutils.notebook.exit("My error message")


    Does anyone know if there is a way to do this please?

    Continue reading...

Compartilhe esta Página