Registry / communication / apache-airflow-providers-sendgrid

apache-airflow-providers-sendgrid

JSON →
library4.2.4pypypiunverified

The `apache-airflow-providers-sendgrid` package integrates Apache Airflow with SendGrid, a popular email delivery service, allowing users to send emails programmatically from Airflow DAGs. It includes operators and hooks to interact with the SendGrid API. The provider is actively maintained, with version 4.2.2 being the latest, and releases frequently in alignment with Apache Airflow's provider release cycle.

pip install apache-airflow-providers-sendgrid
INSTALL
IMPORT
SIG · APACHE-AIRFLOW-PRO
A
apache-airflow-providers-sendgrid
communicationpythonv4.2.4
Install
23.3s avg
Import
Disk
253MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.2.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 253.3MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 23.3s · import 0.000s · 251MB
253MB installed
● package 253MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SendGridOperator
from airflow.providers.sendgrid.operators.sendgrid import SendGridOperator
from airflow.providers.sendgrid.operators.sendgrid import SendGridOperator

This quickstart DAG demonstrates how to use the `SendGridOperator` to send an email. It assumes a SendGrid connection named `sendgrid_default` is configured in Airflow. For local testing, you can set the connection via an environment variable `AIRFLOW_CONN_SENDGRID_DEFAULT` using your SendGrid API Key.

import os from datetime import datetime from airflow import DAG from airflow.providers.sendgrid.operators.sendgrid import SendGridOperator # Ensure you have a SendGrid API Key configured in Airflow Connections # named 'sendgrid_default'. For a quick start, you can set an environment variable: # export AIRFLOW_CONN_SENDGRID_DEFAULT='sendgrid://:YOUR_SENDGRID_API_KEY@' # Replace 'YOUR_SENDGRID_API_KEY' with your actual key (starting with SG.) with DAG( dag_id='sendgrid_email_example', start_date=datetime(2023, 1, 1), schedule_interval=None, catchup=False, tags=['sendgrid', 'email'], ) as dag: send_email_task = SendGridOperator( task_id='send_test_email', sendgrid_conn_id='sendgrid_default', to='recipient@example.com', # Replace with actual recipient subject='Airflow SendGrid Test Email', html_content='<strong>This is a test email from Airflow via SendGrid!</strong>', from_email='sender@example.com', # Replace with actual sender (verified in SendGrid) )
airflow --version
Debug
Known issues
breakingProvider version compatibility with Apache Airflow: Different provider versions require specific minimum Airflow versions. Installing a provider version incompatible with your Airflow setup might lead to automatic Airflow upgrades or `ModuleNotFoundError` if dependencies are not met. For example, provider 4.2.2 requires Airflow >= 2.11.0, while 3.0.0 required Airflow >= 2.2.0.
fix
Always check the `apache-airflow-providers-sendgrid` PyPI page or documentation for the exact `apache-airflow` version requirement compatible with your provider version before installation. Upgrade Airflow if necessary (e.g., `pip install 'apache-airflow[cncf.kubernetes,celery]==X.Y.Z' --constraint ...`).
affects: All versions
deprecatedFetching SendGrid credentials from environment variables (e.g., `SENDGRID_API_KEY`) directly is deprecated. It's recommended to configure SendGrid connections via Airflow's connection mechanism for better security and management.
fix
Use Airflow Connections (either via UI or environment variable `AIRFLOW_CONN_SENDGRID_DEFAULT`) to store your SendGrid API key. Place the API key (e.g., `SG.xyz...`) in the 'Password' field of the connection. The connection ID is typically `sendgrid_default`. Example environment variable: `export AIRFLOW_CONN_SENDGRID_DEFAULT='sendgrid://:YOUR_API_KEY@'`
affects: 1.0.1 and later
gotchaSendGrid connection type might not appear in the Airflow UI dropdown for older Airflow versions or if the provider is not correctly registered. This can lead to confusion when setting up connections.
fix
Ensure your Airflow installation is up-to-date (Airflow 2.2.0+ is recommended). If the issue persists, create the connection programmatically via the Airflow CLI or environment variables, or restart Airflow components. Make sure to use `Conn Type: SendGrid` in the UI if available.
affects: < Airflow 2.2.0 (provider version 2.0.1 and earlier)
gotchaIncorrect `ModuleNotFoundError` when DAGs try to import `airflow.providers.sendgrid.operators` or `hooks`. This usually indicates that the provider package was not installed correctly or there are Python environment issues in the Airflow worker context.
fix
Verify that `pip install apache-airflow-providers-sendgrid` completed successfully in the environment where your Airflow workers run. Check your `requirements.txt` if using a managed Airflow service like MWAA or Astronomer, and ensure all dependencies are correctly installed. A common cause is misconfigured virtual environments or Docker images.
affects: All versions
Upgrade
Version history
4.2.4latest on PyPI · released Jun 7, 2026
Audit
Dependencies
apache-airflowrequiredCore Apache Airflow library; required for provider functionality.
sendgridrequiredOfficial SendGrid Python SDK.
sendgridrequiredOfficial SendGrid Python SDK.
apache-airflow-providers-common-compatrequiredProvides compatibility utilities across different Airflow provider versions.
werkzeugrequiredHTTP utility library; specific versions required for certain Python versions.
werkzeugrequiredHTTP utility library; specific versions required for certain Python versions.
Agent activity
43 hits · last 30 days
node
38
OpenAI (training)
3
Resources
apache-airflow-providers-sendgrid — pip install apache-airflow-providers-sendgrid · libregistry