MySQL-db lib for Python 3.x?

后端 未结 9 1311
南方客
南方客 2020-12-05 13:16

So, looking for a mysql-db-lib that is compatible with py3k/py3.0/py3000, any ideas? Google turned up nothing.

9条回答
  •  执笔经年
    2020-12-05 13:53

    There are currently a few options for using Python 3 with mysql:

    https://pypi.python.org/pypi/mysql-connector-python

    • Officially supported by Oracle
    • Pure python
    • A little slow
    • Not compatible with MySQLdb

    https://pypi.python.org/pypi/pymysql

    • Pure python
    • Faster than mysql-connector
    • Almost completely compatible with MySQLdb, after calling pymysql.install_as_MySQLdb()

    https://pypi.python.org/pypi/cymysql

    • fork of pymysql with optional C speedups

    https://pypi.python.org/pypi/mysqlclient

    • Django's recommended library.
    • Friendly fork of the original MySQLdb, hopes to merge back some day
    • The fastest implementation, as it is C based.
    • The most compatible with MySQLdb, as it is a fork
    • Debian and Ubuntu use it to provide both python-mysqldb andpython3-mysqldb packages.

    benchmarks here: https://github.com/methane/mysql-driver-benchmarks

提交回复
热议问题