import pysqlite2 or import sqlite3?
MonkeeSage
MonkeeSage at gmail.com
Mon Nov 26 01:30:46 EST 2007
On Nov 25, 3:30 pm, Nick Craig-Wood <n... at craig-wood.com> wrote:
> MonkeeSage <MonkeeS... at gmail.com> 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
>
> here
>
> 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 <n... at craig-wood.com> --http://www.craig-wood.com/nick
Didn't know that! Seeing that only two attributes differed between
them in your demonstration, I looked at the __init__.py for the
package, and all it does is "from dbapi2 import *". Learn something
new every day. :)
Regards,
Jordan
More information about the Python-list
mailing list