【发布时间】:2019-11-16 15:45:06
【问题描述】:
我正在使用Django 2.1.3,pymysql 0.9.2,mysql 5.7,python3.5
sql_mode in mysql:
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
db setting in django:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
...,
'OPTIONS': {
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
'charset': 'utf8mb4'
},
}
我总是收到这样的警告:
/venv3.5/lib/python3.5/site-packages/pymysql/cursors.py:170: Warning: (3135, "'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.")
result = self._query(query)
/venv3.5/lib/python3.5/site-packages/pymysql/cursors.py:170: Warning: (3090, "Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.")
result = self._query(query)
为什么我会收到上述警告?
非常欢迎任何评论。非常感谢。
【问题讨论】:
标签: python mysql django pymysql