import pysqlite2 or import sqlite3?

Nick Craig-Wood nick at
Sun Nov 25 22:30:04 CET 2007

MonkeeSage <MonkeeSage at> wrote:
>  I use the following for a progam I wrote using sqlite, to ensure
>  maximum compatibility (since the API is the same, importing them both
>  as 'sqlite' should be fine):
>  try:
>    from sqlite3 import dbapi2 as sqlite # python 2.5

I've been using

     import sqlite3 as sqlite


sqlite3 and sqlite3.dbapi2 seem to be the same thing

    Python 2.5.1 (r251:54863, Aug 17 2007, 00:51:07)
    [GCC 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from sqlite3 import dbapi2
    >>> import sqlite3
    >>> set(dir(sqlite3)) ^ set(dir(dbapi2))
    set(['__path__', 'dbapi2'])

Nick Craig-Wood <nick at> --

More information about the Python-list mailing list