okorienev opened a new issue, #27348:
URL: https://github.com/apache/airflow/issues/27348

   ### Apache Airflow version
   
   2.4.2
   
   ### What happened
   
   Set up new Airflow installation, faced following issues (think that they all 
related to using wrong schema)
   - All tasks in a DAG always fail with worker error
   - Some airflow (both core & provider) tables are created in the wrong schema:
       - `session`
       - `alembic_version`
       - `celery_taskmeta`
       - `celery_tasksetmeta`
   - Some queries ignore the specified schema (log_template synchronization at 
least)
   
   ### What you think should happen instead
   
   - DAGs run normally
   - All Airflow tables are created in the specified schema
   - All queries use specified schema instead of the default schema
   
   ### How to reproduce
   
   Airflow config:
   ```
   AIRFLOW__CORE__EXECUTOR: CeleryExecutor
   AIRFLOW__CORE__LOAD_EXAMPLES: False
   AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: 
'postgresql://user@localhost:5433/postgres'
   AIRFLOW__DATABASE__SQL_ALCHEMY_SCHEMA: data_sources_airflow
   ```
   Postgres container environment:
   ```yaml
   environment:
     - POSTGRES_DB=postgres
     - POSTGRES_USER=user
     - POSTGRES_PASSWORD=
     - POSTGRES_HOST_AUTH_METHOD=trust
   ```
   
   Connect to Postgres and run
   ```SQL
   CREATE SCHEMA data_sources_airflow;
   ```
   
   Commands to init airflow db & create user:
   ```
   airflow db init
   airflow users create \
     --firstname admin \
     --lastname admin \
     --username airflow \
     --password airflow \
     --role Admin \
     --email [email protected]
   ```
   
   - Sign in to Airflow UI with `airflow:airflow` and try to run any DAG 
(should fail)
   - Check database structure for specified schema and default schema (both 
`public` and `data_sources_airflow` schema contain airflow tables)
   
   ### Operating System
   
   Darwin <hostname> 21.6.0 Darwin Kernel Version 21.6.0: Wed Aug 10 14:25:27 
PDT 2022; root:xnu-8020.141.5~2/RELEASE_X86_64 x86_64
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-celery @ 
file:///Users/okorienev/Library/Caches/pypoetry/artifacts/96/6b/b9/8938d11c22dab0fa3ccb34232a8ec54458d3f53b78cf367e80665388db/apache_airflow_providers_celery-3.0.0-py3-none-any.whl
   apache-airflow-providers-common-sql @ 
file:///Users/okorienev/Library/Caches/pypoetry/artifacts/89/8d/91/5e6052c25a6913fe1a75b14d8f358dd5d7fdfc265a2ad0752b5d80ce9a/apache_airflow_providers_common_sql-1.1.0-py3-none-any.whl
   apache-airflow-providers-ftp @ 
file:///Users/okorienev/Library/Caches/pypoetry/artifacts/10/22/6c/6d76ffaf8c5176340d7623d9b802a5d292eed2cbdbb5cc7e02540bfd3e/apache_airflow_providers_ftp-3.1.0-py3-none-any.whl
   apache-airflow-providers-http @ 
file:///Users/okorienev/Library/Caches/pypoetry/artifacts/70/5b/49/202801d6f6a0607855a9bd3ba74e9e34a9024cd9c3702632c5058b72f5/apache_airflow_providers_http-2.0.0-py3-none-any.whl
   apache-airflow-providers-imap @ 
file:///Users/okorienev/Library/Caches/pypoetry/artifacts/7c/a1/74/870d83a7cfffcb419fab974d246e12e26076726df210a74a6533e485d9/apache_airflow_providers_imap-3.0.0-py3-none-any.whl
   apache-airflow-providers-sqlite @ 
file:///Users/okorienev/Library/Caches/pypoetry/artifacts/c4/2d/22/63e1af4fbc4884051f612e87d3842182a0411e21a80431c2df86dc2821/apache_airflow_providers_sqlite-3.2.0-py3-none-any.whl
   
   ### Deployment
   
   Virtualenv installation
   
   ### Deployment details
   
   Airflow installed via poetry (`poetry add [email protected] -E celery`)
   Postgres 13.5.1
   
   
   ### Anything else
   
   Worker error log when task fails:
   ```
    ERROR/ForkPoolWorker-15] [4ebf03e4-ea1d-4661-b427-f07fb00cc624] Failed to 
execute task No log_template entry found for ID None. Please make sure you set 
up the metadatabase correctly..
   ```
   Web server log about missing `log_template` table (after each launch)
   ```
   [2022-10-27 13:09:06,451] {db.py:843} INFO - Log template table does not 
exist (added in 2.3.0); skipping log template sync.
   ```
   Web server log about creating security DB (after each launch, by each worker 
process)
   ```
   [2022-10-28 15:29:09,599] {manager.py:103} INFO - Security DB not found 
Creating all Models from Base
   [2022-10-28 15:29:09,599] {manager.py:103} INFO - Security DB not found 
Creating all Models from Base
   [2022-10-28 15:29:09,607] {manager.py:103} INFO - Security DB not found 
Creating all Models from Base
   [2022-10-28 15:29:09,617] {manager.py:103} INFO - Security DB not found 
Creating all Models from Base
   [2022-10-28 15:29:09,862] {manager.py:105} INFO - Security DB Created
   [2022-10-28 15:29:09,875] {manager.py:105} INFO - Security DB Created
   [2022-10-28 15:29:09,904] {manager.py:105} INFO - Security DB Created
   [2022-10-28 15:29:09,919] {manager.py:105} INFO - Security DB Created
   ```
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to