django.db.utils.InterfaceError: "(0, '')"
When this error appears
If this error occurs intermittently when retrieving records or tables, the connection character encoding might not be correct.
If you are connecting with utf8, try switching to utf8mb4 and see if that resolves the issue.
DATABASES = {
"default": {
"ENGINE": "django.db.backends.mysql",
"NAME": "....",
"USER": "....",
"PASSWORD": "....",
"HOST": "....",
"PORT": "",
"OPTIONS": {
"charset": "utf8mb4"
},
Additional note on 2021-08-07
As mentioned in the above link, when the MySQL client is version 8.0 and the server is version 5.7, the character encoding cannot be specified from the client-side.
Therefore, regarding character encoding, it is best to specify it on the server-side and not specify it from the client-side
(do not specify OPTIONS in the DATABASES).
Comments