Environment: Python 3.5+, Django 1.9+
When initially using Django, the search found Pymysql articles a lot, but in the official Django document Python3 version of the MySQL client driver did not mention Pymysql, only referred to Mysqlclient, and then look down to find:
1. The authors of two libraries are the same person Inada Naoki, pip Library mailboxes are all pointing to mailto:[email protected]
2. Pymysql code personnel Methane said mysqlclient faster and Pymysql application Scenarios , see: https://github.com/PyMySQL/PyMySQL/issues/342
Mysqlclient-python is much faster than pymysql.
When to use Pymysql is:
- You can ' t use libmysqlclient for some reason
- You want to use monkeypatched socket of gevent or Eventlet
- You wan ' t to hack MySQL protocol
3. DJANGO1.9.12 Official Documentation:
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.
4. Https://python.libhunt.com/project/mysqlclient-python/vs/pymysql comparison of the two fundamentals
By contrast, prepare to use mysqlclient! first.
Comparison of Mysqlclient and Pymysql