--- id: django-mysql version: "4.19.0" license: MIT license_treatment: permissive maintenance: active --- # django-mysql — Django-MySQL extends Django's built-in MySQL and MariaDB support their specific features not available on other databases. License: permissive · Maintenance: active · Downloads: 742.8K/mo ## What it is and what it does Django-MySQL is a bridge library that unlocks MySQL and MariaDB capabilities within Django's ORM that would otherwise be unavailable. It provides QuerySet extensions for efficient pagination and approximate counting, specialized model fields like MariaDB Dynamic Columns and comma-separated fields, direct access to over 20 MySQL-specific SQL functions, and utilities for database-level operations like named locks and table management. The package is designed for Django projects that have committed to MySQL or MariaDB and want to leverage database-specific optimizations and features. It integrates directly into Django's model and queryset layers, so usage typically involves importing custom field classes or manager methods rather than learning a separate API. The library maintains compatibility with current Django versions (4.2 through 6.0) and modern Python (3.9+), with no external compiled dependencies beyond what Django itself requires. Use it for: - Optimize pagination on large querysets using chunked iteration instead of loading all results into memory. - Get quick row count estimates using approx_count instead of expensive COUNT(*) queries on massive tables. - Store semi-structured data like configuration dictionaries using MariaDB Dynamic Columns without a separate JSON column. - Implement application-level locking on shared resources using MySQL named locks without external lock services. - Leverage MySQL-specific functions like JSON operations or string functions directly in ORM expressions. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Django-MySQL extends Django's ORM with MySQL and MariaDB-specific features including QuerySet optimizations, specialized model fields, MySQL functions, and database utilities not available in Django's generic database layer. Yes, if your Django project uses MySQL or MariaDB and you need database-specific optimizations or features. The package is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and integrates cleanly with current Django versions. Install friction is minimal. If you use PostgreSQL or SQLite, this package provides no value. ## Install pip install django-mysql uv add django-mysql poetry add django-mysql ## Installing django-mysql Before you install: Low install friction with a single pure-Python wheel dependency on django. Actively maintained with recent commits and a stable production release status across Django 4.2 through 6.0 and Python 3.9 through 3.14. License in practice: MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects. Quickstart: pip install django-mysql from django_mysql.models import QuerySet from django.db import models class MyModel(models.Model): objects = QuerySet.as_manager() class Meta: db_table = 'my_table' Requires Django and MySQL/MariaDB as the project database; features are only available when using MySQL or MariaDB, not other database backends. Verify before relying: - Whether approx_count performance gains are significant for typical table sizes in production environments. - Compatibility guarantees with MySQL versions beyond those explicitly tested in CI. - Performance characteristics of the MySQL upsert-based cache backend compared to standard Django cache backends. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 742.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags django mysql mariadb extensions, django orm mysql specific features, mysql queryset optimization, django mysql cache backend, mariadb dynamic columns django, django-extension, mysql-mariadb, orm-optimization [View on SkillFed](https://skillfed.io/packages/django-mysql) · [View on PyPI](https://pypi.org/project/django-mysql/)