简体   繁体   中英

Postgres for Airflow backend DB to create metadata tables in a specified schema

I'm setting up postgres backend for Airflow metadata DB using the following sqlalchemy connection string:

sql_alchemy_conn = postgresql+psycopg2://<user>:<pass>@<host>:5432/<db>

When I run initdb/upgradedb, the tables are created in public schema.

Is there a way to create the tables in a specified schema?

Can the schema where I would like the tables to be created be specified as part of the connection string?

From the docs :

Also note that since SqlAlchemy does not expose a way to target a specific schema in the Postgres connection URI, you may want to set a default schema for your role with a command similar to ALTER ROLE username SET search_path = airflow, foobar;

So, connect to postgres, and set the search path for your user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM