欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 运维知识 > 数据库 >内容正文

数据库

python mysql库对比_mysqlclient和PyMySQL对比

发布时间:2025/4/16 数据库 57 豆豆
生活随笔 收集整理的这篇文章主要介绍了 python mysql库对比_mysqlclient和PyMySQL对比 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

环境:Python 3.5+, Django 1.9+

最初用django时,搜索时发现PyMySQL的文章很多,然而在django的官方文档中python3版的mysql客户端驱动确没有提到PyMySQL,只提到了mysqlclient,再细看下去发现:

1. 两个库的作者是同一个人INADA Naoki, pip库邮箱都指向mailto:songofacandy@gmail.com

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官方文档中:

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  两者基本面的对比

经上对比,准备先用mysqlclient!

总结

以上是生活随笔为你收集整理的python mysql库对比_mysqlclient和PyMySQL对比的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。