This is an automated email from the ASF dual-hosted git repository.

shahar1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new a1cd080b7db Stop recommending psycopg3 connection strings on older 
Airflow (#70619)
a1cd080b7db is described below

commit a1cd080b7db25252d92ccbaa7cdf7f2c19378f4b
Author: Shahar Epstein <[email protected]>
AuthorDate: Fri Sep 11 21:52:20 2026 +0300

    Stop recommending psycopg3 connection strings on older Airflow (#70619)
---
 providers/amazon/docs/executors/batch-executor.rst        |  6 +++---
 providers/amazon/docs/executors/ecs-executor.rst          |  6 +++---
 providers/amazon/docs/executors/general.rst               | 15 +++++++++++++++
 providers/amazon/docs/executors/lambda-executor.rst       |  6 +++---
 providers/celery/provider.yaml                            |  5 ++++-
 .../src/airflow/providers/celery/get_provider_info.py     |  4 ++--
 6 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/providers/amazon/docs/executors/batch-executor.rst 
b/providers/amazon/docs/executors/batch-executor.rst
index 8f71ba7d8c5..51ffe2b433f 100644
--- a/providers/amazon/docs/executors/batch-executor.rst
+++ b/providers/amazon/docs/executors/batch-executor.rst
@@ -296,9 +296,9 @@ Create a Job Definition
 
 - ``AIRFLOW__DATABASE__SQL_ALCHEMY_CONN``, with the value being the PostgreSQL 
connection string in the following format using the values set during the 
`Database section <#create-the-rds-db-instance>`_ above:
 
-.. code-block:: bash
-
-   postgresql+psycopg://<username>:<password>@<endpoint>/<database_name>
+.. include:: general.rst
+  :start-after: .. BEGIN SQL_ALCHEMY_CONN
+  :end-before: .. END SQL_ALCHEMY_CONN
 
 7. Add other configuration as necessary for Airflow generally (see `here 
<https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html>`__),
 the Batch executor (see :ref:`here <config-options>`) or for remote logging 
(see :ref:`here <logging>`). Note that any configuration changes should be made 
across the entire Airflow environment to keep configuration consistent.
 
diff --git a/providers/amazon/docs/executors/ecs-executor.rst 
b/providers/amazon/docs/executors/ecs-executor.rst
index fd534cb27de..54fdc927db2 100644
--- a/providers/amazon/docs/executors/ecs-executor.rst
+++ b/providers/amazon/docs/executors/ecs-executor.rst
@@ -330,9 +330,9 @@ Create Task Definition
 
 - ``AIRFLOW__DATABASE__SQL_ALCHEMY_CONN``, with the value being the PostgreSQL 
connection string in the following format using the values set during the 
`Database section <#create-the-rds-db-instance>`_ above:
 
-.. code-block:: bash
-
-   postgresql+psycopg://<username>:<password>@<endpoint>/<database_name>
+.. include:: general.rst
+  :start-after: .. BEGIN SQL_ALCHEMY_CONN
+  :end-before: .. END SQL_ALCHEMY_CONN
 
 
 - ``AIRFLOW__ECS_EXECUTOR__SECURITY_GROUPS``, with the value being a comma 
separated list of security group IDs associated with the VPC used for the RDS 
instance.
diff --git a/providers/amazon/docs/executors/general.rst 
b/providers/amazon/docs/executors/general.rst
index a337fffcbf8..8de62ba3f6d 100644
--- a/providers/amazon/docs/executors/general.rst
+++ b/providers/amazon/docs/executors/general.rst
@@ -312,6 +312,21 @@ You will be prompted to enter the password if the 
connection is successful.
 .. END DATABASE_CONNECTION
 
 
+.. BEGIN SQL_ALCHEMY_CONN
+
+.. code-block:: bash
+
+   postgresql+psycopg2://<username>:<password>@<endpoint>/<database_name>
+
+.. note::
+   ``psycopg2`` works on every Airflow version these executors support. From 
Airflow 3.2.0 you may use
+   ``postgresql+psycopg://`` instead, provided ``psycopg`` (v3) is installed. 
Airflow before 3.2.0 does not
+   guarantee SQLAlchemy 2.0 (2.11 and 3.0.x pin ``<2.0``), and SQLAlchemy 1.4 
has no
+   ``postgresql+psycopg`` dialect — Airflow fails to start with 
``sqlalchemy.exc.NoSuchModuleError``.
+
+.. END SQL_ALCHEMY_CONN
+
+
 .. BEGIN ECR_STEPS
 
 Create an ECR Repository
diff --git a/providers/amazon/docs/executors/lambda-executor.rst 
b/providers/amazon/docs/executors/lambda-executor.rst
index 4ceb5c3bea9..7e5ae77bc86 100644
--- a/providers/amazon/docs/executors/lambda-executor.rst
+++ b/providers/amazon/docs/executors/lambda-executor.rst
@@ -332,9 +332,9 @@ Finally create the function:
 
 - ``AIRFLOW__DATABASE__SQL_ALCHEMY_CONN``, with the value being the PostgreSQL 
connection string in the following format using the values set during the 
`Database section <#create-the-rds-db-instance>`_ above:
 
-.. code-block:: bash
-
-   postgresql+psycopg://<username>:<password>@<endpoint>/<database_name>
+.. include:: general.rst
+  :start-after: .. BEGIN SQL_ALCHEMY_CONN
+  :end-before: .. END SQL_ALCHEMY_CONN
 
 
 - ``AIRFLOW__LAMBDA_EXECUTOR__QUEUE_URL``, with the value being the URL of the 
SQS queue created above.
diff --git a/providers/celery/provider.yaml b/providers/celery/provider.yaml
index 2f3122c1f36..ad6d6e0278f 100644
--- a/providers/celery/provider.yaml
+++ b/providers/celery/provider.yaml
@@ -248,10 +248,13 @@ config:
           The use of a database is highly recommended
           When not specified, sql_alchemy_conn with a db+ scheme prefix will 
be used
           
https://docs.celeryq.dev/en/latest/userguide/configuration.html#task-result-backend-settings
+          The psycopg2 driver in the example below works on every supported 
Airflow version.
+          Set db+postgresql+psycopg:// only on Airflow 3.2.0 and later - 
earlier releases do not
+          guarantee SQLAlchemy 2.0, which is where the psycopg (v3) dialect 
lives
         version_added: ~
         type: string
         sensitive: true
-        example: "db+postgresql+psycopg://postgres:airflow@postgres/airflow"
+        example: "db+postgresql+psycopg2://postgres:airflow@postgres/airflow"
         default: ~
       result_backend_sqlalchemy_engine_options:
         description: |
diff --git a/providers/celery/src/airflow/providers/celery/get_provider_info.py 
b/providers/celery/src/airflow/providers/celery/get_provider_info.py
index 02c71ab36ac..7fd3ba29bde 100644
--- a/providers/celery/src/airflow/providers/celery/get_provider_info.py
+++ b/providers/celery/src/airflow/providers/celery/get_provider_info.py
@@ -126,11 +126,11 @@ def get_provider_info():
                         "default": "redis://redis:6379/0",
                     },
                     "result_backend": {
-                        "description": "The Celery result_backend. When a job 
finishes, it needs to update the\nmetadata of the job. Therefore it will post a 
message on a message bus,\nor insert it into a database (depending of the 
backend)\nThis status is used by the scheduler to update the state of the 
task\nThe use of a database is highly recommended\nWhen not specified, 
sql_alchemy_conn with a db+ scheme prefix will be 
used\nhttps://docs.celeryq.dev/en/latest/userguide/configuration. [...]
+                        "description": "The Celery result_backend. When a job 
finishes, it needs to update the\nmetadata of the job. Therefore it will post a 
message on a message bus,\nor insert it into a database (depending of the 
backend)\nThis status is used by the scheduler to update the state of the 
task\nThe use of a database is highly recommended\nWhen not specified, 
sql_alchemy_conn with a db+ scheme prefix will be 
used\nhttps://docs.celeryq.dev/en/latest/userguide/configuration. [...]
                         "version_added": None,
                         "type": "string",
                         "sensitive": True,
-                        "example": 
"db+postgresql+psycopg://postgres:airflow@postgres/airflow",
+                        "example": 
"db+postgresql+psycopg2://postgres:airflow@postgres/airflow",
                         "default": None,
                     },
                     "result_backend_sqlalchemy_engine_options": {

Reply via email to