Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Latest commit

 

History

History
37 lines (28 loc) · 1.18 KB

README.md

File metadata and controls

37 lines (28 loc) · 1.18 KB

mysqlclient-collate

Fork of mysqlclient which adds support for setting collation via connection options.

Setting collation is necessary for servers that do not use the default, and for Django queries using CAST statements, which are prevalent in Wagtail 4. For more background, see the following discussions:

Usage

Make sure you have MySQL or MariaDB C connector, and a C compiler installed.

IMPORTANT: If you already have mysqlclient installed, uninstall it before installing this fork. Both projects use the same module name and cannot be installed at the same time.

pip uninstall mysqlclient
pip install mysqlclient-collate

For use in a Django project, set your database connection as so:

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.mysql",
        "HOST": "",
        "NAME": "",
        "USER": "",
        "PASSWORD": "",
        "OPTIONS": {
            "charset": "utf8mb4",
            "collation": "utf8mb4_unicode_ci",
        },
    }
}