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。