Truly platform-independent DB access in Python?

skip at pobox.com skip at pobox.com
Mon Aug 28 10:31:51 EDT 2006


    boris> I am using the Python DB API for access to MySQL. But it is not
    boris> platform-independent - I need a module not included in Python by
    boris> default - python-mysql, and it uses a compiled binary
    boris> _mysql.so. So it is not platform-independent because for each
    boris> web-server on different platform, I would have to download it and
    boris> extra compile it specifically for that platform. Do you know of
    boris> any Python solution for MySQL access that is 100%
    boris> platform-independent?

I don't think you mean "platform-independent".  I suspect you mean
"batteries included".  Prior to the release of Python 2.5, no modules to
access SQL databases were distributed with core Python.  Starting with 2.5,
sqlite access will be available:

    >>> import sqlite3
    >>> sqlite3.__file__
    '/Users/skip/local/lib/python2.5/sqlite3/__init__.pyc'

So, if what you were really asking was "what SQL databases can I access
without installing any software other than Python?", then the answer is "No
SQL databases were distributed with Python prior to 2.5.  Starting with
Python 2.5, access to sqlite databases is available by default."  Python 2.5
is due out soon (according to PEP 356, on 12 September).

The still-officially-in-development-but-almost-certainly-frozen
documentation for the sqlite3 module is here:

    http://docs.python.org/dev/lib/module-sqlite3.html

Skip



More information about the Python-list mailing list