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

coderedcorp/mysqlclient-collate

 
 

Repository files navigation

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",
        },
    }
}

About

MySQL database connector for Python (with Python 3 support)

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 65.6%
  • C 34.3%
  • Makefile 0.1%