From 27139d02d566a9cfd7470d7156b39a97e7aeb38a Mon Sep 17 00:00:00 2001 From: Shahar Epstein <60007259+shahar1@users.noreply.github.com> Date: Fri, 24 Jul 2026 09:37:50 +0300 Subject: [PATCH] Document psycopg3 driver switch for PostgresHook connections The 7.0.0 breaking-change notes describe only the metadata database, so a user on Airflow 3.2 or 3.3 reading them concludes they are unaffected until 3.4. In fact PostgresHook picks its driver independently, from the installed SQLAlchemy version, so their task connections switch to psycopg3 on upgrade with no connection-URL or config opt-out available. --- providers/postgres/docs/changelog.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/providers/postgres/docs/changelog.rst b/providers/postgres/docs/changelog.rst index 58c064600e691..d7cb4899d2fbb 100644 --- a/providers/postgres/docs/changelog.rst +++ b/providers/postgres/docs/changelog.rst @@ -63,6 +63,21 @@ Breaking changes To keep using psycopg2 on Airflow 3.4.0+, set ``[database] sql_alchemy_conn = postgresql+psycopg2://...`` explicitly. +.. note:: + The two notes above describe the **metadata database** only. Independently of them, + ``PostgresHook`` selects ``psycopg`` (psycopg3) for the connections it opens whenever + SQLAlchemy 2.x is installed — the default on Airflow 3.2 and later, and also the case on + Airflow 3.1 if SQLAlchemy has been upgraded to 2.x. Airflow 2.11 and 3.0 pin SQLAlchemy below + 2.0 and are unaffected. + + The ``google``, ``pgvector`` and ``amazon`` (Redshift SQLAlchemy/OpenLineage engine) + integrations follow the same selection, as does a Celery ``result_backend`` derived from the + metadata-database URL — unless ``[celery] result_backend`` is set explicitly. + + There is no connection or configuration option to keep hooks on psycopg2; the + ``sql_alchemy_conn`` workarounds above cover the metadata database only. If your Dags rely on + psycopg2-specific behaviour, test before upgrading or pin the provider below 7.0.0. + * ``Make psycopg (v3) the default synchronous Postgres driver (#69526)`` * ``Switch the default async Postgres driver from asyncpg to psycopg3 (#69089)``