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

1 完整的异常信息:

1
2
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查到一条回答

1
2
3
4
5
6
7
8
9
10
11
12
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 @   Questions张  阅读(1951)  评论(0编辑  收藏  举报
编辑推荐:
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
阅读排行:
· Blazor Hybrid适配到HarmonyOS系统
· Obsidian + DeepSeek:免费 AI 助力你的知识管理,让你的笔记飞起来!
· 解决跨域问题的这6种方案,真香!
· 分享4款.NET开源、免费、实用的商城系统
· 一套基于 Material Design 规范实现的 Blazor 和 Razor 通用组件库
点击右上角即可分享
微信分享提示