This blog walks through approaches to implement custom notifications using SMTP, SendGrid, Azure Logic Apps, and Microsoft Graph API. Using SMTP with Python inside a Databricks notebook, you can generate an Excel report and send it via email whenever a pipeline fails.This blog walks through approaches to implement custom notifications using SMTP, SendGrid, Azure Logic Apps, and Microsoft Graph API. Using SMTP with Python inside a Databricks notebook, you can generate an Excel report and send it via email whenever a pipeline fails.

Custom Email Notifications for Databricks Pipeline Failures

When working with Databricks pipelines and workflows, failures are inevitable. While Databricks provides built-in notifications for job failures, these alerts are often not customizable and may not fit specific reporting or formatting needs. A more flexible and cost-effective approach is to set up custom email notifications that include pipeline details and error messages in a structured format, such as an Excel attachment.

This blog walks through approaches to implement custom notifications using SMTP, SendGrid, Azure Logic Apps, and Microsoft Graph API.

Why Custom Notifications?

  • Flexible formatting: Include pipeline metadata, error messages, and runtime details.
  • Attachments: Share structured reports (Excel, CSV, etc.) instead of plain text.
  • Cost efficiency: Avoid additional third-party monitoring solutions.
  • Integration options: Easily plug into existing email infrastructure.

Approach 1: SMTP-Based Notifications

Using SMTP with Python inside a Databricks notebook, you can generate an Excel report and send it via email whenever a pipeline fails.

Example Implementation

import smtplib from email.mime.multipart import MIMEMultipart from email.mime.base import MIMEBase from email.mime.text import MIMEText from email import encoders from io import BytesIO import pandas as pd  #Sample pipeline history df = spark.createDataFrame([ ('pipeline1', 'success', '7min'), ('pipeline1', 'fail', '3min'), ('pipeline1', 'success', '10min') ], ["PipelineName", "Status", "Duration"])  # Convert DataFrame to Excel output = BytesIO()  with pd.ExcelWriter(output, engine='xlsxwriter') as writer:  df_pd = df.toPandas()  df_pd.to_excel(writer, index=False, sheet_name='Sheet1')  workbook = writer.book  worksheet = writer.sheets['Sheet1'] 
# Apply formatting header_format = workbook.add_format({     'bold': True,     'bg_color': '#FFF00',     'border': 1,     'align': 'center',     'valign': 'vcenter' }) for col_num, value in enumerate(df_pd.columns):     worksheet.write(0, col_num, value.upper(), header_format)  cell_format = workbook.add_format({'border': 1}) for row in range(1, len(df_pd) + 1):     for col in range(len(df_pd.columns)):         worksheet.write(row, col, df_pd.iloc[row-1, col], cell_format)  for i, col in enumerate(df_pd.columns):     worksheet.set_column(i, i, 20) output.seek(0)  # Email configuration sender = "from@example.com" receiver = "to@example.com" subject = "Pipeline Execution Report" body = """Hello Team,  Please find the attachment of the latest pipeline report.  Thanks, Pipeline Team"""  msg = MIMEMultipart() msg['From'] = sender msg['To'] = receiver msg['Subject'] = subject msg.attach(MIMEText(body, 'plain'))  part = MIMEBase('application', 'vnd.openxmlformats-officedocument.spreadsheetml.sheet') part.set_payload(output.read()) encoders.encode_base64(part) part.add_header('Content-Disposition', 'attachment; filename="pipeline_report.xlsx"') msg.attach(part)  smtp_server = "smtp.office.com" smtp_port = 587  with smtplib.SMTP(smtp_server, smtp_port) as server:     server.starttls()     server.login(sender, "sender_password")     server.send_message(msg)  print("Email sent successfully with Excel attachment") 

Scheduling Notifications

You can automate the notification trigger by scheduling the notebook:

Option 1: Databricks Jobs

  • Create or edit a Databricks job.
  • Add a task dependency so the notification script runs only if the previous task fails.
  • This ensures error details are captured and reported immediately.

Option 2: Azure Logic Apps

  • Configure a Logic App that listens for pipeline failures.
  • Pass pipeline details and attachments via an API call in JSON format.
  • Logic Apps handle email delivery and retry mechanisms.

Conclusion

While Databricks provides basic failure notifications, extending them with custom SMTP or Logic App workflows ensures:

  • Rich, formatted reports.
  • Team visibility with detailed context.
  • Seamless integration with enterprise communication tools.

This approach is cost-effective, scalable, and easily adaptable for large-scale pipeline monitoring.

Piyasa Fırsatı
Suilend Logosu
Suilend Fiyatı(SEND)
$0,2335
$0,2335$0,2335
-%1,31
USD
Suilend (SEND) Canlı Fiyat Grafiği
Sorumluluk Reddi: Bu sitede yeniden yayınlanan makaleler, halka açık platformlardan alınmıştır ve yalnızca bilgilendirme amaçlıdır. MEXC'nin görüşlerini yansıtmayabilir. Tüm hakları telif sahiplerine aittir. Herhangi bir içeriğin üçüncü taraf haklarını ihlal ettiğini düşünüyorsanız, kaldırılması için lütfen service@support.mexc.com ile iletişime geçin. MEXC, içeriğin doğruluğu, eksiksizliği veya güncelliği konusunda hiçbir garanti vermez ve sağlanan bilgilere dayalı olarak alınan herhangi bir eylemden sorumlu değildir. İçerik, finansal, yasal veya diğer profesyonel tavsiye niteliğinde değildir ve MEXC tarafından bir tavsiye veya onay olarak değerlendirilmemelidir.

Ayrıca Şunları da Beğenebilirsiniz

Crypto News: Donald Trump-Aligned Fed Governor To Speed Up Fed Rate Cuts?

Crypto News: Donald Trump-Aligned Fed Governor To Speed Up Fed Rate Cuts?

The post Crypto News: Donald Trump-Aligned Fed Governor To Speed Up Fed Rate Cuts? appeared on BitcoinEthereumNews.com. In recent crypto news, Stephen Miran swore in as the latest Federal Reserve governor on September 16, 2025, slipping into the board’s last open spot right before the Federal Open Market Committee kicks off its two-day rate discussion. Traders are betting heavily on a 25-basis-point trim, which would bring the federal funds rate down to 4.00%-4.25%, based on CME FedWatch Tool figures from September 15, 2025. Miran, who’s been Trump’s top economic advisor and a supporter of his trade ideas, joins a seven-member board where just three governors come from Democratic picks, according to the Fed’s records updated that same day. Crypto News: Miran’s Background and Quick Path to Confirmation The Senate greenlit Miran on September 15, 2025, with a tight 48-47 vote, following his nomination on September 2, 2025, as per a recent crypto news update. His stint runs only until January 31, 2026, stepping in for Adriana D. Kugler, who stepped down in August 2025 for reasons not made public. Miran earned his economics Ph.D. from Harvard and worked at the Treasury back in Trump’s first go-around. Afterward, he moved to Hudson Bay Capital Management as an economist, then looped back to the White House in December 2024 to head the Council of Economic Advisers. There, he helped craft Trump’s “reciprocal tariffs” approach, aimed at fixing trade gaps with China and the EU. He wouldn’t quit his White House gig, which irked Senator Elizabeth Warren at the September 7, 2025, confirmation hearings. That limited time frame means Miran gets to cast a vote straight away at the FOMC session starting September 16, 2025. The full board now features Chair Jerome H. Powell (Trump pick, term ends 2026), Vice Chair Philip N. Jefferson (Biden, to 2036), and folks like Lisa D. Cook (Biden, to 2028) and Michael S. Barr…
Paylaş
BitcoinEthereumNews2025/09/18 03:14
Kodiak Sciences Announces Pricing of Upsized Public Offering of Common Stock

Kodiak Sciences Announces Pricing of Upsized Public Offering of Common Stock

PALO ALTO, Calif., Dec. 16, 2025 /PRNewswire/ — Kodiak Sciences Inc. (Nasdaq: KOD), a precommercial retina focused biotechnology company committed to researching
Paylaş
AI Journal2025/12/17 12:15
Oil jumps over 1% on Venezuela oil blockade

Oil jumps over 1% on Venezuela oil blockade

Oil prices rose more than 1 percent on Wednesday after US President Donald Trump ordered “a total and complete” blockade of all sanctioned oil tankers entering
Paylaş
Agbi2025/12/17 11:55