- Prevent
collections.abc.Sequence
warning.
- Update Python support to 3.5-3.8.
- Converted setuptools metadata to configuration file. This meant removing the
__version__
attribute from the package. If you want to inspect the installed version, useimportlib.metadata.version("django-mysql")
(docs / backport). - Fix
GroupConcat
to work with bothseparator
andordering
set. (PR #596).
- Update Python support to 3.5-3.7, as 3.4 has reached its end of life.
- Always cast SQL params to tuples in ORM code.
- Remove authors file and documentation page. This was showing only 4 out of the 17 total contributors.
- Tested on Django 2.2. No changes were needed for compatibility.
- Remove universal wheel. Version 3.0.0 has been pulled from PyPI after being up for 3 hours to fix mistaken installs on Python 2.
- Drop Python 2 support, only Python 3.4+ is supported now.
- Drop Django 1.8, 1.9, and 1.10 support. Only Django 1.11+ is supported now.
- Django 2.1 compatibility - no code changes were required, releasing for PyPI trove classifiers and documentation.
- Added
JSONArrayAppend
database function that wraps the respective JSON-modifying function from MySQL 5.7.
- Made
EnumField
escape its arguments in apymysql
-friendly fashion.
- Started testing with MariaDB 10.3.
- Changed
GlobalStatus.wait_until_load_low()
to increase the default number of allowed running threads from 5 to 10, to account for the new default threads in MariaDB 10.3. - Added
encoder
anddecoder
arguments toJSONField
for customizing the way JSON is encoded and decoded from the database. - Added a
touch
method to theMySQLCache
to refresh cache keys, as added in Django 2.1. - Use a temporary database connection in system checks to avoid application startup stalls.
- Fixed some crashes from
DynamicField
instances without explicitspec
definitions. - Fixed a crash in system checks for
ListCharField
andSetCharField
instances missingmax_length
.
- Fixed
JSONField.deconstruct()
to not break the path for subclasses.
- Add
output_field
argument toJSONExtract
function. - Improved DB version checks for
JSONField
andDynamicField
so you can have just one connection that supports them. - Django 2.0 compatibility.
- Changed subprocess imports for compatibility with Google App Engine.
- (Insert new release notes below this line)
- Made
MySQLCache.set_many
return a list as per Django 2.0.
- Django 1.11 compatibility
- Some fixes to work with new versions of
mysqlclient
Fixed
JSONField
model field string serialization. This is a small backwards incompatible change.Storing strings mostly used to crash with MySQL error -1 "error totally whack", but in the case your string was valid JSON, it would store it as a JSON object at the MySQL layer and deserialize it when returned. For example you could do this:
>>> mymodel.attrs = '{"foo": "bar"}' >>> mymodel.save() >>> mymodel = MyModel.objects.get(id=mymodel.id) >>> mymodel.attrs {'foo': 'bar'}
The new behaviour now correctly returns what you put in:
>>> mymodel.attrs '{"foo": "bar"}'
Removed the
connection.is_mariadb
monkey patch. This is a small backwards incompatible change. Instead of using it, usedjango_mysql.utils.connection_is_mariadb
.
- Only use Django's vendored six (
django.utils.six
). Fixes usage ofEnumField
and field lookups whensix
is not installed as a standalone package. - Added
JSONInsert
,JSONReplace
andJSONSet
database functions that wraps the respective JSON-modifying functions from MySQL 5.7. - Fixed
JSONField
to work with Django's serializer framework, as used in e.g.dumpdata
. - Fixed
JSONField
form field so that it doesn't overquote inputs when redisplaying the form due to invalid user input.
- Don't allow NaN in
JSONField
because MySQL doesn't support it
- Dropped Django 1.7 support
- Made the query hint functions raise
RuntimeError
if you haven't activated the query-rewriting layer in settings.
- Fixed some features to work when there are non-MySQL databases configured
- Fixed
JSONField
to allow control characters, which MySQL does - but not in a top-level string, only inside a JSON object/array.
SmartChunkedIterator
now fails properly for models whose primary key is a non-integer foreign key.pty
is no longer imported at the top-level indjango_mysql.utils
, fixing Windows compatibility.
- Added new
JSONField
class backed by the JSON type added in MySQL 5.7. - Added database functions
JSONExtract
,JSONKeys
, andJSONLength
that wrap the JSON functions added in MySQL 5.7, which can be used with the JSON type columns as well as JSON data held in text/varchar columns. - Added
If
database function for simple conditionals.
- Now MySQL 5.7 compatible
- The final message from
SmartChunkedIterator
is now rounded to the nearest second. Lock
andTableLock
classes now haveacquire
andrelease()
methods for using them as normal objects rather than context managers
- Added
manage.py
commandfix_datetime_columns
that outputs the SQL necessary to fix anydatetime
columns intodatetime(6)
, as required when upgrading a database to MySQL 5.6+, or MariaDB 5.3+. SmartChunkedIterator
output now includes the total time taken and number of objects iterated over in the final message.
- Fixed the new system checks to actually work
- Fixed
EnumField
so that it works properly with forms, and does not accept themax_length
argument. SmartChunkedIterator
output has been fixed for reversed iteration, and now includes a time estimate.- Added three system checks that give warnings if the MySQL configuration can (probably) be improved.
- New function
add_QuerySetMixin
allows addding theQuerySetMixin
to arbitraryQuerySet
s, for when you can't edit a model class. - Added field class
EnumField
that uses MySQL'sENUM
data type.
- Added
chunk_min
argument toSmartChunkedIterator
- Changed version number to 1.0.0 to indicate maturity.
- Added
DynamicField
for using MariaDB's Named Dynamic Columns, and related database functionsColumnAdd
,ColumnDelete
, andColumnGet
. SmartChunkedIterator
withreport_progress=True
correctly reports 'lowest pk so far' when iterating in reverse.- Fix broken import paths during
deconstruct()
for subclasses of all fields:ListCharField
,ListTextField
,SetCharField
,SetTextField
,SizedBinaryField
andSizedTextField
- Added XML database functions -
UpdateXML
andXMLExtractValue
.
- Allow
approx_count
on QuerySets for which only query hints have been used - Added index query hints to
QuerySet
methods, via query-rewriting layer - Added
ordering
parameter toGroupConcat
to specify theORDER BY
clause - Added index query hints to
QuerySet
methods, via query-rewriting layer - Added
sql_calc_found_rows()
query hint that calculates the total rows that match when you only take a slice, which becomes available on thefound_rows
attribute - Made
SmartChunkedIterator
work withreverse()
'dQuerySet
s
SmartChunkedIterator
now takes an argumentchunk_size
as the initial chunk sizeSmartChunkedIterator
now allows models whose primary key is aForeignKey
- Added
iter_smart_pk_ranges
which is similar toiter_smart_chunks
but yields only the start and end primary keys for each chunks, in a tuple. - Added prefix methods to
MySQLCache
-delete_with_prefix
,get_with_prefix
,keys_with_prefix
- Added
Bit1BooleanField
andNullBit1BooleanField
model fields that work with boolean fields built by other databases that use theBIT(1)
column type
- Added Regexp database functions for MariaDB -
RegexpInstr
,RegexpReplace
, andRegexpSubstr
- Added the option to not limit the size of a
MySQLCache
by settingMAX_ENTRIES
= -1. MySQLCache
performance improvements in get, get_many, and has_key- Added query-rewriting layer added which allows the use of MySQL query hints
such as
STRAIGHT_JOIN
via QuerySet methods, as well as adding label comments to track where queries are generated. - Added
TableLock
context manager
- More database functions added -
Field
and its complementELT
, andLastInsertId
- Case sensitive string lookup added as to the ORM for
CharField
andTextField
- Migration operations added -
InstallPlugin
,InstallSOName
, andAlterStorageEngine
- Extra ORM aggregates added -
BitAnd
,BitOr
, andBitXor
MySQLCache
is now case-sensitive. If you are already using it, an upgradeALTER TABLE
and migration is provided at the end of the cache docs.- (MariaDB only) The
Lock
class gained a class methodheld_with_prefix
to query held locks matching a given prefix SmartIterator
bugfix for chunks with 0 objects slowing iteration; they such chunks most often occur on tables with primary key "holes"- Now tested against Django master for cutting edge users and forwards compatibility
- Added the
MySQLCache
backend for use with Django's caching framework, a more efficient version ofDatabaseCache
- Fix a
ZeroDivision
error inWeightedAverageRate
, which is used in smart iteration
pt_visual_explain
no longer executes the given query before fetching itsEXPLAIN
- New
pt_fingerprint
function that wraps thept-fingerprint
tool efficiently - For
List
fields, the newListF
class allows you to do atomic append or pop operations from either end of the list in a single query - For
Set
fields, the newSetF
class allows you to do atomic add or remove operatiosn from the set in a single query - The
@override_mysql_variables
decorator has been introduced which makes testing code with different MySQL configurations easy - The
is_mariadb
property gets added onto Django's MySQLconnection
class automatically - A race condition in determining the minimum and maximum primary key values for smart iteration was fixed.
- Add
Set
andList
fields which can store comma-separated sets and lists of a base field with MySQL-specific lookups - Support MySQL's
GROUP_CONCAT
as an aggregate! - Add a
functions
module with many MySQL-specific functions for the new Django 1.8 database functions feature - Allow access of the global and session status for the default connection from
a lazy singleton, similar to Django's
connection
object - Fix a different recursion error on
count_tries_approx
- Renamed
connection_name
argument tousing
onLock
,GlobalStatus
, andSessionStatus
classes, for more consistency with Django. - Fix recursion error on
QuerySetMixin
when usingcount_tries_approx
- Added support for
HANDLER
statements as aQuerySet
extension - Now tested on Django 1.8
- Add
pk_range
argument for 'smart iteration' code
- Added
manage.py
commanddbparams
for outputting database paramters in formats useful for shell scripts
- Fix release process
- Added
pt_visual_explain
integration onQuerySet
- Added soundex-based field lookups for the ORM
- Added
get_many
toGlobalStatus
- Added
wait_until_load_low
toGlobalStatus
which allows you to wait for any high load on your database server to dissipate. - Added smart iteration classes and methods for
QuerySet
s that allow efficient iteration over very large sets of objects slice-by-slice.
- Added
Model
andQuerySet
subclasses which add theapprox_count
method
- First release on PyPI
Lock
sGlobalStatus
andSessionStatus