Skip to content

PostgreSQL Database Backend Section Requires some additional info on fallback hosts #25461

Closed

Description

@manmedia

What do you see as an issue?

  1. Airflow uses SQLAlchemy - which in turn uses Psycopg2 for database communication with PostgreSQL backend
  2. It is possible to use multiple database hosts where a High Availability (HA) is required - i.e. a primary database host and one/multiple secondary hosts for a postgreSQL ecosystem. The objective is - when and if the primary database host is unavailable, the connection is retried with the newly-elected primary host to restore database connectivity.
  3. Airflow documentation - https://airflow.apache.org/docs/apache-airflow/stable/howto/set-up-database.html - should provide some indication to where to consult for further info, so that users of Airflow has a better experience in troubleshooting issues with database setup.

Solving the problem

  1. The proposal is to add an additional section under this - https://airflow.apache.org/docs/apache-airflow/stable/howto/set-up-database.html
  2. The section will be marked with "Note"
  3. The section will have the following text

It is possible to have multiple fallback hosts in PostgreSQL so that any loss of primary hosts does not impact your Airflow operation. Airflow currently uses SQLAlchemy for database session management. Please refer to their documentation here for more information.
known issue in SQLAlchemy - sqlalchemy/sqlalchemy#4392 (Related to multiple host URL specification)

Anything else

  1. The issue currently occurs for any Airflow version, especially with multiple fallback hosts for metadata DBs
  2. There is an ongoing bugfix in SQLAlchemy which will ensure that:
    a. URL Specification in psycopg2 is implemented correctly
    b. Documentation in SQLAlchemy is consistent, so that users do not get mislead
  3. I am requesting a thorough code review at airflow side, as I am not a Python developer, and do not fully understand how the code is written. I am happy to submit a PR on documentation change, if this ticket is considered valuable.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. boring-cyborg commented on Aug 2, 2022

    @boring-cyborg

    Thanks for opening your first issue here! Be sure to follow the issue template!

  2. removed
    kind:bug
    on Aug 2, 2022
  3. potiuk commented on Aug 2, 2022

    @potiuk
    Member

    Feel free to add it. BTW. There is no need to add issue. We are PR-driven, not issue-driven. If you make a PR and it's good, accepted and reviewed, we will merge it.

    We are not beauracratic - unless something is a huge change, then it requires a devlist discussion and voting, but if it's a dccumentation update you can just submit it as is, without creating issue first.

  4. potiuk commented on Aug 2, 2022

    @potiuk
    Member

    BTW. Since you created the issue, please refer to it (by number) in your PR so that it will be closed automatically when we merge it.

  5. potiuk commented on Mar 2, 2026

    @potiuk
    Member

    @manmedia We are unassigning you from this issue as part of our updated assignment policy.

    This is not meant to discourage your contribution — quite the opposite! You are still very welcome to work on this issue and submit a PR for it. Simply comment that you are working on it and open a PR when ready.

    We found that formal assignments were not working well, as they often prevented others from contributing when the assignee was not actively working on the issue.

  6. 54 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions