[Python-ideas] Official MySQL module
Guido van Rossum
guido at python.org
Fri Mar 8 00:50:49 CET 2013
On Thu, Mar 7, 2013 at 3:20 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Fri, Mar 8, 2013 at 7:41 AM, Eric V. Smith <eric at trueblade.com> wrote:
>> On 3/7/2013 4:16 PM, David Mertz wrote:
>>> I disagree moderately with Dustin. Obviously, it is true that a magic
>>> wand doesn't produce a standard-library module. However, having support
>>> for MySQL/MariaDB (and PostgreSQL) in the standard library would be
>>> desirable. This would bring MySQL support to the same level as we have
>>> for SQLite3.
>>> In particular, I would NOT WANT such standard library support to include
>>> any ORM layer to it; I feel like those should remain as third-party
>>> tools (and compete on their various merits). But the basic level of
>>> providing a *binding* feels like something desirable (and specifically,
>>> a binding that was as close to a drop-in substitute for 'sqlite3' as
>> I agree with David on both points.
>> - Surely a MySQL binding is a battery we should consider including, if
>> an author were to offer it to us. I have no experience with them, so I
>> can't offer any advice on which is best.
> We've learned the hard way that including database bindings in the
> standard library is a bad idea, as development on those bindings needs
> to be synchronised with the release cycle of the corresponding
> database server, not the Python release cycle. The bsddb bindings in
> Python 2 were a neverending source of trouble, which is why they were
> booted out to PyPI for Python 3.
Hm. It's true that bsddb was a neverending nightmare. But AFAIR that
was due to the bsddb C bindings changing regularly.
> sqlite3 is different (and more appropriate for the standard library),
> as it's a wrapper around a file format rather than a binding to an
> active database server.
Hardly. SQLite3 is probably as complex as bsddb. It is just better
maintaned, and its authors have an incredible dedication to backwards
compatibility at the C API level. (Watch this talk:
Honestly, I don't know what the status of the C bindings for MySQL is,
but it might well be similar. MySQL is a pretty mature product.
(And I don't agree with Greg P Smith's complete rejection of including
anything in the stdlib that we don't distribute. There are certainly
plenty of optional dependencies, from Tcl/Tk to GNU readline.)
> The number one question to ask about candidates for standard library
> inclusion is "Does it make sense for this module to receive new
> features only once every 18-24 months, and only when you upgrade to a
> new version of Python?". Interfaces to specific external services
> (including databases) almost never pass that test.
I wouldn't mind if someone looked into this in depth for MySQL and
Postgres. It's been a while since we last looked at this. If the
answer is different for MySQL than for Postgres that shouldn't stop us
from including one but not the other.
Agreed on the "no ORM in the stdlib" position.
--Guido van Rossum (python.org/~guido)
More information about the Python-ideas