mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Refs #23919 -- Removed Python 2 notes in docs.
This commit is contained in:
parent
c716fe8782
commit
f6acd1d271
61 changed files with 139 additions and 731 deletions
|
@ -273,24 +273,18 @@ running ``migrate``::
|
|||
MySQL DB API Drivers
|
||||
--------------------
|
||||
|
||||
The Python Database API is described in :pep:`249`. MySQL has three prominent
|
||||
drivers that implement this API:
|
||||
MySQL has a couple drivers that implement the Python Database API described in
|
||||
:pep:`249`:
|
||||
|
||||
- `MySQLdb`_ is a native driver that has been developed and supported for over
|
||||
a decade by Andy Dustman.
|
||||
- `mysqlclient`_ is a fork of ``MySQLdb`` which notably supports Python 3 and
|
||||
can be used as a drop-in replacement for MySQLdb. At the time of this writing,
|
||||
this is **the recommended choice** for using MySQL with Django.
|
||||
- `mysqlclient`_ is a native driver. It's **the recommended choice**.
|
||||
- `MySQL Connector/Python`_ is a pure Python driver from Oracle that does not
|
||||
require the MySQL client library or any Python modules outside the standard
|
||||
library.
|
||||
|
||||
.. _MySQLdb: https://pypi.python.org/pypi/MySQL-python/1.2.4
|
||||
.. _mysqlclient: https://pypi.python.org/pypi/mysqlclient
|
||||
.. _MySQL Connector/Python: https://dev.mysql.com/downloads/connector/python
|
||||
|
||||
All these drivers are thread-safe and provide connection pooling. ``MySQLdb``
|
||||
is the only one not supporting Python 3 currently.
|
||||
All these drivers are thread-safe and provide connection pooling.
|
||||
|
||||
In addition to a DB API driver, Django needs an adapter to access the database
|
||||
drivers from its ORM. Django provides an adapter for MySQLdb/mysqlclient while
|
||||
|
@ -298,30 +292,10 @@ MySQL Connector/Python includes `its own`_.
|
|||
|
||||
.. _its own: https://dev.mysql.com/doc/connector-python/en/connector-python-django-backend.html
|
||||
|
||||
MySQLdb
|
||||
~~~~~~~
|
||||
|
||||
Django requires MySQLdb version 1.2.1p2 or later.
|
||||
|
||||
At the time of writing, the latest release of MySQLdb (1.2.5) doesn't support
|
||||
Python 3. In order to use MySQLdb under Python 3, you'll have to install
|
||||
``mysqlclient`` instead.
|
||||
|
||||
.. note::
|
||||
There are known issues with the way MySQLdb converts date strings into
|
||||
datetime objects. Specifically, date strings with value ``0000-00-00`` are
|
||||
valid for MySQL but will be converted into ``None`` by MySQLdb.
|
||||
|
||||
This means you should be careful while using :djadmin:`loaddata` and
|
||||
:djadmin:`dumpdata` with rows that may have ``0000-00-00`` values, as they
|
||||
will be converted to ``None``.
|
||||
|
||||
mysqlclient
|
||||
~~~~~~~~~~~
|
||||
|
||||
Django requires `mysqlclient`_ 1.3.3 or later. Note that Python 3.2 is not
|
||||
supported. Except for the Python 3.3+ support, mysqlclient should mostly behave
|
||||
the same as MySQLDB.
|
||||
Django requires `mysqlclient`_ 1.3.3 or later.
|
||||
|
||||
MySQL Connector/Python
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -689,23 +663,6 @@ substring filtering.
|
|||
|
||||
.. _documented at sqlite.org: https://www.sqlite.org/faq.html#q18
|
||||
|
||||
Old SQLite and ``CASE`` expressions
|
||||
-----------------------------------
|
||||
|
||||
SQLite 3.6.23.1 and older contains a bug when `handling query parameters`_ in
|
||||
a ``CASE`` expression that contains an ``ELSE`` and arithmetic.
|
||||
|
||||
SQLite 3.6.23.1 was released in March 2010, and most current binary
|
||||
distributions for different platforms include a newer version of SQLite, with
|
||||
the notable exception of the Python 2.7 installers for Windows.
|
||||
|
||||
As of this writing, the latest release for Windows - Python 2.7.10 - includes
|
||||
SQLite 3.6.21. You can install ``pysqlite2`` or replace ``sqlite3.dll`` (by
|
||||
default installed in ``C:\Python27\DLLs``) with a newer version from
|
||||
https://www.sqlite.org/ to remedy this issue.
|
||||
|
||||
.. _handling query parameters: https://code.djangoproject.com/ticket/24148
|
||||
|
||||
.. _using-newer-versions-of-pysqlite:
|
||||
|
||||
Using newer versions of the SQLite DB-API 2.0 driver
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue