From 069acde0c14f3f42f3928e64221f5d7a7eac77af Mon Sep 17 00:00:00 2001 From: "Tien Duc (TiDu) Nguyen" Date: Fri, 8 Oct 2021 14:36:54 +0700 Subject: [PATCH] Fix wrong Postgres search_path set up instructions (#17600) In the set up instructions for Postgres database backend, the instructed command for setting search_path to the correct schema lacks `public` and `utility`, which prevented SqlAlchemy to find all those required schemas. --- docs/apache-airflow/howto/set-up-database.rst | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/apache-airflow/howto/set-up-database.rst b/docs/apache-airflow/howto/set-up-database.rst index be9a19b80320a..a23e4bc2b5d5c 100644 --- a/docs/apache-airflow/howto/set-up-database.rst +++ b/docs/apache-airflow/howto/set-up-database.rst @@ -218,8 +218,17 @@ We recommend using the ``psycopg2`` driver and specifying it in your SqlAlchemy postgresql+psycopg2://:@/ -Also note that since SqlAlchemy does not expose a way to target a specific schema in the database URI, you may -want to set a default schema for your role with a SQL statement similar to ``ALTER ROLE username SET search_path = airflow, foobar;`` +Also note that since SqlAlchemy does not expose a way to target a specific schema in the database URI, you need to ensure schema ``public`` is in your Postgres user's search_path. + +If you created a new Postgres account for Airflow: + +* The default search_path for new Postgres user is: ``"$user", public``, no change is needed. + +If you use a current Postgres user with custom search_path, search_path can be changed by the command: + +.. code-block:: sql + + ALTER USER airflow_user SET search_path = public; For more information regarding setup of the PostgresSQL connection, see `PostgreSQL dialect `__ in SQLAlchemy documentation.