简体   繁体   English

Python 3.x的MySQL-db lib?

[英]MySQL-db lib for Python 3.x?

So, looking for a mysql-db-lib that is compatible with py3k/py3.0/py3000, any ideas? 那么,寻找一个与py3k / py3.0 / py3000兼容的mysql-db-lib,有什么想法吗? Google turned up nothing. 谷歌没有任何结果。

It appears the MySQLdb is pretty much a dead project. 看来MySQLdb几乎是一个死的项目。 However, PyMySQL is a dbapi compliant, pure-python implementation of a mysql client, and it has python 3 support. 但是, PyMySQL是一个兼容dbapi,纯python的mysql客户端实现,它支持python 3。

EDIT: There's also MySQL Connector/Python . 编辑:还有MySQL Connector / Python Same idea. 同样的想法。

我也在寻找它,但也没有找到任何东西,所以我将MySQL-python-1.2.3移植到py3k你可以在这里阅读http://sourceforge.net/p/mysql-python/discussion/70460/thread/61e3a3c9 /

There are currently a few options for using Python 3 with mysql: 目前有一些使用Python 3和mysql的选项:

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

  • Officially supported by Oracle Oracle正式支持
  • Pure python 纯蟒蛇
  • A little slow 有点慢
  • Not compatible with MySQLdb 与MySQLdb不兼容

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

  • Pure python 纯蟒蛇
  • Faster than mysql-connector 比mysql-connector快
  • Almost completely compatible with MySQLdb , after calling pymysql.install_as_MySQLdb() 在调用pymysql.install_as_MySQLdb()之后,几乎完全兼容MySQLdb

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

  • fork of pymysql with optional C speedups pymysql的fork,带有可选的C加速

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

  • Django's recommended library. Django推荐的库。
  • Friendly fork of the original MySQLdb, hopes to merge back some day 原始MySQLdb的友好分叉,希望有朝一日合并回来
  • The fastest implementation, as it is C based. 最快的实现,因为它是基于C的。
  • The most compatible with MySQLdb, as it is a fork 与MySQLdb最兼容,因为它是一个fork
  • Debian and Ubuntu use it to provide both python-mysqldb and python3-mysqldb packages. Debian和Ubuntu使用它来提供python-mysqldbpython3-mysqldb包。

benchmarks here: https://github.com/methane/mysql-driver-benchmarks 基准测试: https//github.com/methane/mysql-driver-benchmarks

这是Python 3的工作存储库: https//github.com/davispuh/MySQL-for-Python-3

As for future plans of MySQLdb, you might want to ask the author (Andy Dustman). 至于MySQLdb的未来计划,你可能想问作者(Andy Dustman)。
His blog is here: http://mysql-python.blogspot.com/ 他的博客在这里: http//mysql-python.blogspot.com/

不确定你是否还在寻找,但你可以试试这个: http//sourceforge.net/projects/mypysql/

You can download the mysql-connector-python module compatible with Python3: 您可以下载与Python3兼容的mysql-connector-python模块:

http://rpm.pbone.net/index.php3/stat/4/idpl/15667200/dir/rawhide/com/mysql-connector-python3-0.3.2-2.fc16.noarch.rpm.html http://rpm.pbone.net/index.php3/stat/4/idpl/15667200/dir/rawhide/com/mysql-connector-python3-0.3.2-2.fc16.noarch.rpm.html

Get the "source RPM", unzip it and use it (eg put it in your PYTHONPATH, and look at the examples). 获取“源RPM”,解压缩并使用它(例如将其放入PYTHONPATH,并查看示例)。

There is an official Python 2/3 library, downloadable from MySQL website. 有一个官方的Python 2/3库,可以从MySQL网站下载。 Oracle released version 1.0.7 to public on 29 September 2012. Oracle于2012年9月29日向公众发布了1.0.7版本。

It's pure Python and works with MySQL 4.1+ 它是纯Python,适用于MySQL 4.1+

See more details here: http://dev.mysql.com/doc/connector-python/en/connector-python.html 请在此处查看更多详细信息: http//dev.mysql.com/doc/connector-python/en/connector-python.html

I'm currently using it with MySQL 5.5 and Python 3.2 with no problems thus far :) 我目前正在使用它与MySQL 5.5和Python 3.2到目前为止没有问题:)

You're probably better off using Python 2.x at the moment. 你现在可能最好使用Python 2.x. It's going to be a while before all Python packages are ported to 3.x, and I expect writing a library or application with 3.x at the moment would be quite frustrating. 在将所有Python软件包移植到3.x之前还需要一段时间,我希望目前用3.x编写库或应用程序会非常令人沮丧。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM