Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airflow-core/docs/howto/docker-compose/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ x-airflow-common:
AIRFLOW__CORE__EXECUTOR: CeleryExecutor
AIRFLOW__CORE__AUTH_MANAGER: airflow.providers.fab.auth_manager.fab_auth_manager.FabAuthManager
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@postgres/airflow
AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql+psycopg2://airflow:airflow@postgres/airflow
AIRFLOW__CELERY__BROKER_URL: redis://:@redis:6379/0
AIRFLOW__CORE__FERNET_KEY: ${FERNET_KEY}
AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: 'true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ def get_default_celery_config(team_conf) -> dict[str, Any]:
result_backend = team_conf.get_mandatory_value("celery", "RESULT_BACKEND")
else:
log.debug("Value for celery result_backend not found. Using sql_alchemy_conn with db+ prefix.")
result_backend = f"db+{team_conf.get('database', 'SQL_ALCHEMY_CONN')}"
sql_alchemy_conn = team_conf.get("database", "SQL_ALCHEMY_CONN")
# In SQLAlchemy 2.1 the default PostgreSQL driver changed from psycopg2 to psycopg (v3).
# To maintain existing behavior, we explicitly specify psycopg2 for driverless PostgreSQL URLs.
sql_alchemy_conn = sql_alchemy_conn.replace("postgresql://", "postgresql+psycopg2://", 1)
result_backend = f"db+{sql_alchemy_conn}"

# Handle result backend transport options (for Redis Sentinel support)
result_backend_transport_options: dict = (
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/docker-compose/backend-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
environment:
- BACKEND=postgres
- AIRFLOW__DATABASE__SQL_ALCHEMY_CONN=postgresql+psycopg2://postgres:airflow@postgres/airflow
- AIRFLOW__CELERY__RESULT_BACKEND=db+postgresql://postgres:airflow@postgres/airflow
- AIRFLOW__CELERY__RESULT_BACKEND=db+postgresql+psycopg2://postgres:airflow@postgres/airflow
depends_on:
postgres:
condition: service_healthy
Expand Down
Loading