django inspectdb utf8mb4 error

核能气质少年 提交于 2019-12-11 07:22:35

问题


Python manage.py inspectdb is giving following error even after all tables are having CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci

from django.db import models

Unable to inspect table 'execution'

The error was: (3719, "3719: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.", None)


回答1:


I encountered the exact same issue lately. I raised a bug request to Django, but Django do not accept it as their bug.

MySQL 8 has switched from UTF8MB3 to UTF8MB4 as the default charset. As of 8.0.11 if you access a table that was created with the previous version a warning is returned encouraging you to switch to UTF8MB4.

When you run the inspectdb the INFORMATION_SCHEMA tables are still in UTF8MB3 so you get the warning returned to Django, which Django is currently unable to ignore.

I have a fully worked example of how to get around this error on the Django bug ticket: https://code.djangoproject.com/ticket/29678

I have been able to fully use MySQL 8.0.12 as a backend for a robust Django application so once you get past this issue you should hopefully be okay.



来源:https://stackoverflow.com/questions/52081773/django-inspectdb-utf8mb4-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!