1樓:ZHHJemotion
pymysql 和 MySQL Connector吧,但感覺 pymysql 好用一點,尤其寫入大量資料,上千萬條,的時候,MySQL Connector會把記憶體吃的滿滿的,就算批量化插入和定時清理connector和變數快取也不行,不到一千萬條就 OOM 了,pymysql 完全沒事兒,記憶體占有率在 0.5%左右,簡直爽!其他方面二者的比較不是太清楚。
2樓:笨鳥 快飛
There are thee MySQL adapters for Python that are currently maintained:
mysqlclient
- By far the fastest MySQL connector for CPython. Requires the mysql-connector-c C library to work.(MySQLDb1的的更新版,即更好的支援python3.
x。)mysql connector, an all-in python module that uses MySQL API withno C modules dependenciesand only standard python modules used.(MySQL的親兒子)
PyMySQL
- Pure Python MySQL client. According to the maintainer of both mysqlclientand MyPySQL, you should use PyMySQL if:
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.
MySQLdb
stackoverflow鏈結
3樓:saaspeter
經過查閱文件,我決定採用mysqlclient, 其他的如pymysql和MySQL Connector,都有人做過效能測試,效能都不如mysqldb, 而且mysqlclient是mysqldb的fork,完全相容,文件可以直接套用
4樓:語桓
MySQL DB API Drivers
The Python Database API is described in PEP 249. MySQL has three prominent drivers that implement this API:
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 isthe recommended choicefor using MySQL.
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.
5樓:dp zhang
本來想走捷徑,搜尋一下這個問題的答案,結果發現沒有乙個完整的回答。現在把整理結果發布出來。
Python語言操作MySQL資料庫,要遵守DB API 2.0 規範。以下介面都可以:
1,mysql-python也就是MySQLdb;
2,PyMySQL。支援jython,IronPython,CPython等;
3,mxODBC 和 mxODBC Connect。egenix家的東西;
4,pyodbc。需進入http://
code.google.com
;5,MySQL Connector/Python。這個是純python實現的MySQL介面,由Oracle維護;
6,mypysql。由c語言實現,目前還不能完全實現PEP249規範;
7,PyPyODBC。一看就知道支援PyPy;
6樓:
貌似Pymysql能實現非同步mysql訪問,且在官方的github下多了個專案PyMySQL/Tornado-MySQL · GitHub
7樓:shafreeck
用過mysql-python和pymysql,兩者皆有不盡如人意的地方
比如mysql-python是封裝的mysqlclient ,無法到底連線的socket。
而pymysql可以得到連線socket,卻不能使用use_result語義,我有個專案兩種情況都需要。
我只好兩個都用。
8樓:seewind
純python的類庫有:pymysql、mysql-connector。
我們專案中當前使用pymysql,為的是能結合gevent使用。
9樓:淚堅果
我用著比較方便的就是MySQL-Python,也就是Yarkee同學說的MySQLdb。
現在已經在我公司專案中使用,還是很方便的,誒,我記得MySQL-Python就是官方人員參與了的Driver。
有哪些比較好的網校?
高三課程時間安排非常緊湊氛圍也很緊張,心理壓力也很大呀。網課好不好網校是一方面,關鍵是老師好適合你才是關鍵吶。我是理科生,報的是 樂學高考 網課,我覺得這個網校和老師都很不錯,主講老師都是一線教學名師和高考帶班實戰經驗,課後有答疑老師及時答疑,不把問題留過夜。說說我跟過課認為比較好的老師吧 化學 李...
有哪些比較好的爽膚水?
愛妃麗爾AIFEILIER 因為最近長期戴口罩再加上換季乾燥的緣故,肌膚狀態變得很糟糕!稍不注意臉上就會悶個痘出來,不僅不美觀而且非常影響!寶寶們應該都知道,護膚最開始的一步就是用爽膚水,用的好的話就會促進後續產品的吸收,甚至改善膚質,用不好,那可能過敏爆痘出閉口!所以今天就推薦一波好用的爽膚水給大...
python入門選擇什麼書籍比較好?
digolds 沒準以下Python教程會對你有幫助 基礎篇https digolds.cn article 0015 32966908032f8b7750f6b5a42bba8e229e35c62eeb4000 https digolds.cn article 0015 3296794778837...