Bug #109061 cannot load converter_class defined in settings.py
Submitted: 11 Nov 2022 5:53 Modified: 3 Feb 2023 13:12
Reporter: 伟峰 潘 Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / Python Severity:S3 (Non-critical)
Version:8.0.29 OS:Any
Assigned to: MySQL Verification Team CPU Architecture:Any

[11 Nov 2022 5:53] 伟峰 潘
Description:
Environment 
Python 3.9
Django 3.2.16

I define convert_class in  settings.py 
DATABASES = {
    'default': {
        'ENGINE': 'mysql.connector.django',
        'HOST': '127.0.0.1',
        'PORT': ccc,
        'USER': 'ccc',
        'PASSWORD': 'ccc',
        'NAME': 'ccc',
        'OPTIONS': {
            'autocommit': True,
            'charset': 'utf8mb4',
            'converter_class': AAConverter
        }
    }
}

.venv\Lib\site-packages\mysql\connector\django\base.py
line 363
 def get_new_connection(self, conn_params):
        if "converter_class" not in conn_params:
            conn_params["converter_class"] = DjangoMySQLConverter
        cnx = mysql.connector.connect(**conn_params)

        return cnx

actually,  the convert_class will be a class variable of config object.
so.  "converter_class" not in conn_params will always true.

How to repeat:
define convert_class in  settings.py 
DATABASES = {
    'default': {
        'ENGINE': 'mysql.connector.django',
        'HOST': '127.0.0.1',
        'PORT': ccc,
        'USER': 'ccc',
        'PASSWORD': 'ccc',
        'NAME': 'ccc',
        'OPTIONS': {
            'autocommit': True,
            'charset': 'utf8mb4',
            'converter_class': AAConverter
        }
    }
}
[3 Jan 2023 13:12] MySQL Verification Team
Hello,

Thank you for the bug report.
Could you please provide more info(sample code, exact steps, exceptions if any) to reproduce this issue at our end?

Regards,
Ashwini Patil
[4 Feb 2023 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".