气流无法初始化数据库

时间:2019-03-18 14:15:58

标签: python-2.7 airflow ubuntu-18.04

已安装并配置了mysql db的apache airflow,没有任何错误。 问题是当我airflow initdbairflow resetdb抛出以下错误/异常时

sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1292, "Incorrect datetime value: '2019-03-18 13:44:21.317153+00:00' for column 'last_scheduler_run' at row 1") [SQL: u'INSERT INTO dag (dag_id, is_paused, is_subdag, is_active, last_scheduler_run, last_pickled, last_expired, scheduler_lock, pickle_id, fileloc, owners) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)'] [parameters: ('example_skip_dag', 1, 0, 1, datetime.datetime(2019, 3, 18, 13, 44, 21, 317153, tzinfo=<Timezone [UTC]>), None, None, None, None, '/usr/local/lib/python2.7/dist-packages/airflow/example_dags/example_skip_dag.py', u'airflow')] (Background on this error at: http://sqlalche.me/e/e3q8)

我如何成功运行Apache Airflow 1.10.2

1 个答案:

答案 0 :(得分:1)

只为将来的用户做个总结:

停止服务:

systemctl stop mysql

获取当前状态:

mysql> select @@sql_mode;

在不添加“ STRICT_TRANS_TABLES”的情况下向配置添加语句:

sudo nano /etc/mysql/my.cnf

在[mysqld]下:

sql_mode="paste "select @@sql_mode;" output **without** STRICT_TRANS_TABLES"

然后重新启动服务:

systemctl start mysql