Warning: (1287, @@tx_isolation is deprecated and will be removed in a future release
程序员文章站
2022-07-14 22:59:24
...
在 使用flask中使用SQL alchemy通过模型类创建数据表并保存数据时 会出现一个警告,不是错误!
并不会影响项目运行,如果项目启动不了,应该是别的地方出问题了。
Warning: (1287, "'@@tx_isolation' is deprecated and will be removed in a future release. Please use '@@transaction_isolation' instead")
翻译
@@tx_isolation被禁止使用并且在未来的版本中会被移除,请使用’@@transaction_isolation’代替
解决办法
进入~/.virtualenvs/Flask_py/lib/python3.6/site-packages/sqlalchemy/dialects/mysql$
目录找到base.py
进行编辑
然后加上
if self.server_version_info < (5, 7, 20):
cursor.execute('SELECT @@tx_isolation')
else:
cursor.execute('SELECT @@transaction_isolation')
效果如下:
上一篇: 跟我学hadoop学习3
下一篇: 跟我学spark1
推荐阅读
-
@@tx_isolation is deprecated and will be removed in a future release.Please use '@@transacti :bug修复
-
Warning: (1287, @@tx_isolation is deprecated and will be removed in a future release
-
MySQL - 1681 Integer display width is deprecated and will be removed in a future release
-
警告解决 : java.sql.SQLWarning: '@@tx_isolation' is deprecated and will be removed in a future release.