Why use _mysql module and not use MySQLdb directly?

Marcel Rodrigues marcelgmr at gmail.com
Sun Feb 9 11:40:05 CET 2014


Another option is PyMySQL [1]. It's developed in the open at GitHub [2].
It's pure Python, compatible with both Python 2 and Python 3. It's DB-API 2
compliant. It also implements some non-standard bits that are present in
MySQLdb, in order to be compatible with legacy code, notably Django
(personally, I consider the use of non-standard API from a DB adapter a
bug, but while the big projects don't fix it, we have to work around it).

[1] https://pypi.python.org/pypi/PyMySQL
[2] https://github.com/PyMySQL/PyMySQL


2014-02-08 10:09 GMT-02:00 Asaf Las <roegltd at gmail.com>:

> On Saturday, February 8, 2014 1:42:30 PM UTC+2, Chris Angelico wrote:
> > On Sat, Feb 8, 2014 at 10:32 PM, Asaf Las <r... at gmail.com> wrote:
> >
> > > Hi Chris
> > > The doc says
> > > https://pypi.python.org/pypi/mysql-connector-python/1.1.5
> > > MySQL driver written in Python which does not depend on MySQL C
> > > client libraries and implements the DB API v2.0 specification
> (PEP-249).
> >
> > Ah. And that links to dev.mysql.com, so it's presumably the same
> > thing... would be nice if they'd say that on their own site. That's
> > what I was looking for, anyhow. Confirms the suspicion.
> >
> > There may well be performance differences between pure-Python
> > implementations and ones that go via C, but having used a
> > pure-high-level-language implementation of PostgreSQL's wire protocol
> > (granted, that was Pike, which is a somewhat higher performance
> > language than Python, but same difference), I can assure you of what
> > ought to be obvious anyway: that performance is dominated by the
> > server's throughput and thus (usually) by disk speed. So it's going to
> > be pretty much the same with all of them; look for ancillary features
> > that might make your life easier, otherwise pick whichever you like.
> >
> > ChrisA
>
> Hmmm, they say :
>
> http://dev.mysql.com/doc/connector-python/en/connector-python-introduction.html
>
> "MySQL Connector/Python enables Python programs to access MySQL databases,
> using an API that is compliant with the Python DB API version 2.0. It
> is written in pure Python and does not have any dependencies except for
> the Python Standard Library..."
>
> i guess with Oracle connector there could be one advantage - they will
> try to be most compliant to their product in every aspect as they would
> raiser promote their DB instead of discouraging from it.
>
> /Asaf
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140209/7dc475cd/attachment.html>


More information about the Python-list mailing list