docker-airflow
docker-airflow copied to clipboard
airflow initdb failed
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
I had the same problem
+1... do either of you have a workaround?
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
also got it :( did someone figured the root cause?
I used airflow init db and worked finally