Airflow安装错误:sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError)

1 完整的异常信息:

raise errorclass, errorvalue
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1292, "Incorrect datetime value: '2019-10-18 13:41:07.937196+00:00' for column 'last_scheduler_run' at row 1") [SQL: u'UPDATE dag SET last_scheduler_run=%s, description=%s, schedule_interval=%s WHERE dag.dag_id = %s'] [parameters: (datetime.datetime(2019, 10, 18, 13, 41, 7, 937196, tzinfo=<Timezone [UTC]>), 'spark ETL ', '"55 00  * * *"', 'sparkEtl’)]

  

2 安装Airflow 执行 airflow initdb,遇到上面的错误

3 最后解决,Stack Overflow查到一条回答

mysql的模式问题
Just to recap for future users:
Stop the service:
systemctl stop mysql
Get the current state:
mysql> select @@sql_mode;
Add statement to the config without "STRICT_TRANS_TABLES":
sudo nano /etc/mysql/my.cnf
under [mysqld]:
sql_mode="paste "select @@sql_mode;" output **without** STRICT_TRANS_TABLES"
Then start the service again:
systemctl start mysql

4 最后解决,原来是自己的/etc/my.cnf中配置了

sql_mode='STRICT_TRANS_TABLES'

 

删除上面的STRICT_TRANS_TABLES参数,重启就ok了。如果这个配置和其他配置冲突,建议airflow安装独立的mysql。

 

posted @ 2019-10-20 20:13  Questions张  阅读(1926)  评论(0编辑  收藏  举报