Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initdb but table schema is unknown #551

Open
LvXinPeng opened this issue May 9, 2020 · 5 comments
Open

initdb but table schema is unknown #551

LvXinPeng opened this issue May 9, 2020 · 5 comments

Comments

@LvXinPeng
Copy link

LvXinPeng commented May 9, 2020

I use airflow 1.10.9;

below is part of exception:

sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1054, "Unknown column 'dag.root_dag_id' in 'field list'")
[SQL: SELECT dag.dag_id AS dag_dag_id, dag.root_dag_id AS dag_root_dag_id, dag.is_paused AS dag_is_paused, dag.is_subdag AS dag_is_subdag, dag.is_active AS dag_is_active, dag.last_scheduler_run AS dag_last_scheduler_run, dag.last_pickled AS dag_last_pickled, dag.last_expired AS dag_last_expired, dag.scheduler_lock AS dag_scheduler_lock, dag.pickle_id AS dag_pickle_id, dag.fileloc AS dag_fileloc, dag.owners AS dag_owners, dag.description AS dag_description, dag.default_view AS dag_default_view, dag.schedule_interval AS dag_schedule_interval
FROM dag
WHERE dag.is_subdag = 0 AND dag.is_active = 1 ORDER BY dag.dag_id
LIMIT %s, %s]
[parameters: (0, 100)]
(Background on this error at: http://sqlalche.me/e/e3q8)

@wittfabian
Copy link

wittfabian commented May 11, 2020

When does the error occur?

@LvXinPeng
Copy link
Author

When does the error occur?

After executing "airflow initdb"

@wittfabian
Copy link

I had to create a user first.

airflow list_users || (airflow initdb
      && airflow create_user --role Admin --username airflow --password airflow -e airflow@airflow.com -f airflow -l airflow)

See: apache/airflow#8605 (comment)

@wittfabian
Copy link

Issue solved?

@ibnubay
Copy link

ibnubay commented Aug 6, 2020

To fix it:

  1. if you are using "MySQL" as Airflow backend, set explicit_defaults_for_timestamp=1 or "on" in Google Cloud SQL
  2. "Clear" dag folder before run airflow initdb
  3. You can create admin user on this step
    Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants