Dev-iL opened a new pull request, #68314:
URL: https://github.com/apache/airflow/pull/68314

   related: 
https://github.com/apache/airflow/pull/61229https://github.com/apache/airflow/pull/61229
 #67801
   
   ## Context
   
   SQLAlchemy 2.0 aliases the bare `postgresql://` scheme to 
`postgresql+psycopg2://`, but that implicit default is changing: SQLAlchemy 2.1 
will swap it to psycopg3. This means any deployment that relies on the bare 
scheme today is silently coupled to psycopg2, and when we eventually switch the 
Postgres provider to psycopg3 (making `postgresql+psycopg://` and 
`postgresql+psycopg_async://` the intended dialects), we cannot safely do a 
simple find-and-replace because we cannot tell which bare `postgresql://` 
strings were written with psycopg2 in mind versus ones that were just following 
the docs by example. We've already seen the implications of this in 
https://github.com/apache/airflow/pull/62159.
   
   By replacing every bare `postgresql://` with the fully-qualified 
`postgresql+psycopg2://` now, we make the current driver selection explicit and 
auditable, so the future switch to psycopg3 becomes a clean, mechanical, 
reviewable substitution rather than a hunt for implicit assumptions scattered 
across docs, config defaults, chart values, and tests.
   
   ## Changes
   
   - **`airflow-core/src/airflow/configuration.py`** — 
`_upgrade_postgres_metastore_conn()` now upgrades legacy `postgres://` / 
`postgres+psycopg2://` configs all the way to `postgresql+psycopg2://` instead 
of bare `postgresql://`.
   - **`providers/google/.../cloud_sql.py`** — four Cloud SQL proxy URL 
templates made explicit.
   - **`providers/celery/provider.yaml` + `get_provider_info.py`** — Celery 
result-backend example updated to `db+postgresql+psycopg2://`.
   - **`airflow-core/src/airflow/cli/commands/connection_command.py`** — 
doc-comment example updated.
   - **34 test, documentation, chart, and deployment files** — all bare 
`postgresql://` occurrences replaced with `postgresql+psycopg2://`.
   
   ## Intentionally unchanged
   
   - `jdbc:postgresql://` URLs (JDBC driver, unrelated to SQLAlchemy).
   - The `.replace("postgresql://", "postgresql+psycopg2://", 1)` runtime 
normalisation in `providers/celery/.../default_celery.py` — this remains as a 
safety net for operator-supplied connection strings that have not yet been 
updated.
   - Two historical changelog entries in 
`providers/postgres/docs/changelog.rst` that describe the earlier `postgres://` 
→ `postgresql://` migration.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, 
please
   change below checkbox to `[X]` followed by the name of the tool, uncomment 
the "Generated-by".
   -->
   
   - [x] Yes (please specify the tool below)
   
   
   Generated-by: Claude Code (Sonnet 4.6) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   ---
   
   * Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information. Note: commit author/co-author name and email in commits 
become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: 
`{pr_number}.significant.rst`, in 
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
 You can add this file in a follow-up commit after the PR is created so you 
know the PR number.
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* * * * * * * * * * * * * * * * * * * * * * * * 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to