You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ep...@apache.org on 2022/03/22 19:16:38 UTC

[airflow] 27/31: Add documentation on specifying a DB schema. (#22347)

This is an automated email from the ASF dual-hosted git repository.

ephraimanierobi pushed a commit to branch v2-2-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 36bc0dc164eb2e6ea960233b6b0226588245f6af
Author: nick <ni...@shook.family>
AuthorDate: Sun Mar 20 00:28:19 2022 -0700

    Add documentation on specifying a DB schema. (#22347)
    
    * Add documentation on specifying a DB schema.
    
    From request - https://github.com/apache/airflow/issues/17374#issuecomment-1060019956
    
    Co-authored-by: Nick Shook <ni...@apple.com>
    (cherry picked from commit 3bc0da326e7963eab9154913d5cafbc1be1c1a67)
---
 docs/apache-airflow/howto/set-up-database.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/docs/apache-airflow/howto/set-up-database.rst b/docs/apache-airflow/howto/set-up-database.rst
index 14051b3..e556ec6 100644
--- a/docs/apache-airflow/howto/set-up-database.rst
+++ b/docs/apache-airflow/howto/set-up-database.rst
@@ -314,6 +314,16 @@ Other configuration options
 
 There are more configuration options for configuring SQLAlchemy behavior. For details, see :ref:`reference documentation <config:core>` for ``sqlalchemy_*`` option in ``[core]`` section.
 
+For instance, you can specify a database schema where Airflow will create its required tables. If you want Airflow to install its tables in the ``airflow`` schema of a PostgreSQL database, specify these environment variables:
+
+.. code-block:: bash
+
+    export AIRFLOW__CORE__SQL_ALCHEMY_CONN="postgresql://postgres@localhost:5432/my_database?options=-csearch_path%3Dairflow"
+    export AIRFLOW__CORE__SQL_ALCHEMY_SCHEMA="airflow"
+
+Note the ``search_path`` at the end of the ``SQL_ALCHEMY_CONN`` database URL.
+
+
 Initialize the database
 -----------------------