docker-airflow icon indicating copy to clipboard operation
docker-airflow copied to clipboard

airflow initdb failed

Open trourance opened this issue 6 years ago • 5 comments

Hi, The airflow initdb initial command failed if the dags contain variables (not already defined at that point).

postgres_1 | ERROR: relation "variable" does not exist at character 149 postgres_1 | STATEMENT: SELECT variable.val AS variable_val, variable.id AS variable_id, variable.key AS variable_key, variable.is_encrypted AS variable_is_encrypted postgres_1 | FROM variable postgres_1 | WHERE variable.key = 'chop_cat_path' postgres_1 | LIMIT 1 webserver_1 | ERROR [airflow.models.DagBag] Failed to import: /usr/local/airflow/dags/mydag.py webserver_1 | Traceback (most recent call last): webserver_1 | File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1236, in _execute_context webserver_1 | cursor, statement, parameters, context webserver_1 | File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 536, in do_execute webserver_1 | cursor.execute(statement, parameters) webserver_1 | psycopg2.ProgrammingError: relation "variable" does not exist webserver_1 | LINE 2: FROM variable

trourance avatar Mar 27 '19 11:03 trourance

I had the same problem

kehindetomiwa avatar Oct 01 '19 20:10 kehindetomiwa

+1... do either of you have a workaround?

apurvis avatar Oct 22 '19 19:10 apurvis

You can try to run airflow upgradedb, for me it didn't work but I found out a workaround with adding a dummy variable from the UI. Here the steps that worked for me: https://stackoverflow.com/a/59672488/7067655

SolbiatiAlessandro avatar Jan 09 '20 21:01 SolbiatiAlessandro

also got it :( did someone figured the root cause?

jazzyguitar avatar Feb 20 '21 16:02 jazzyguitar

I used airflow init db and worked finally

dianaparedes avatar Oct 12 '21 04:10 dianaparedes