pysqlite and sqlite versions

1,643 views
Skip to first unread message

Chris Spencer

unread,
Nov 16, 2010, 3:14:24 PM11/16/10
to python...@googlegroups.com
from sqlite3 import dbapi2 as sql
sql.sqlite_version
'3.6.21'

The sqlite3 module shipped with Python 2.7 shows that the sqlite
version it is compiled with is 3.6.21.

However, sqlite itself is at version 3.7.3 (as shown on
http://www.sqlite.org/ ). The home page recommends this version for
all development.

Are there any plans to use the 3.7.3 version of sqlite in a future
release of pysqlite?

Chris.

Roger Binns

unread,
Nov 16, 2010, 5:22:15 PM11/16/10
to python...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can bind SQLite into pysqlite in two ways. One way uses the
amalgamation and includes the SQLite code directly in with pysqlite. ie any
other instances of SQLite on the system are ignored. pysqlite refers to
this as a static build. To change the SQLite version requires recompiling
pysqlite but does not affect any other files on your system.

The second method is to dynamically link against SQLite. SQLite itself is
in a shared library and found at runtime. You can put a newer version where
it gets found first (eg set $LD_LIBRARY_PATH on Unix) or replace the shared
library that is being used which may affect other programs.

You didn't say which operating system you are using nor how you got SQLite.
If you are using 32 bit Python on Windows as your email headers imply then
you can download the latest SQLite Windows DLL from sqlite.org and put it in
c:\python27\dlls

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzjBBMACgkQmOOfHg372QTbGACfZPJ+z3JYRVD2iFUAAEZAPxej
XBMAn3kQa6SYED6YMrpises/2+YeGKJQ
=pZPD
-----END PGP SIGNATURE-----

Chris Spencer

unread,
Nov 16, 2010, 5:29:23 PM11/16/10
to python...@googlegroups.com
Thank you very much for your pointers. I will investigate this avenue
of approach.

I'm a bit curious why the "official" pysqlite version has been allowed
to fall so far behind in terms of sqlite versions. But it's just a
curiosity. With your solution, I can roll my own.

I appreciate your detailed response.

Chris.

Roger Binns

unread,
Nov 16, 2010, 5:48:43 PM11/16/10
to python...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/16/2010 02:29 PM, Chris Spencer wrote:
> I'm a bit curious why the "official" pysqlite version has been allowed
> to fall so far behind in terms of sqlite versions.

There are 3 separate things you are conflating. There is the SQLite library
itself. Despite how it may appear, that library is remarkably rock solid.
When bugs are found they are extremely rare. Even then the team recommends
an upgrade because a one in 100 million user issue will affect someone.
Every Android phone, iPhone, Firefox, Chrome, Safari, almost all Linux
desktops not to mention lots of other deployments is using SQLite. The bugs
usually require doing some extraordinary combination of things. If you do
not change your code then you are very unlikely to hit the bugs. Read this
to understand why SQLite is so robust:

http://www.sqlite.org/testing.html

Or in other words when they recommend a SQLite upgrade it is to go from
99.999996% robustness to 99.999997% robustness. None of the other software
you are using is that good to start with!

There is the pysqlite project which provides DBAPI access to SQLite and
updates and its own rate.

There is the sqlite3 module within Python. This is a fork of pysqlite.

When they ship Python it includes the sqlite3 module and only includes bug
fixes for the lifetime of that release. For example Python 2.7 will have
the same sqlite module for 2.7.1, 2.7.2 etc plus bug fixes. Even if
pysqlite is updated that would only be pulled into Python 2.8 or 3 dot next.

The official deliverable from python.org is the Python source including
sqlite3 module source. It does not include pysqlite or SQLite.

For your convenience and because Windows folk usually do not have compilers
they also provide a pre-compiled version. This also happens to include the
SQLite DLL which you can replace. You could also delete it and have one on
your path or in a system directory picked up instead.

Windows binary Python does not include an automatic updater and they aren't
going to do a new binary release every time there is a new SQLite release.

Thank them for their convenience and if you want total control then you
should install from source so you have complete control over versions and
compilation options. Linux users can also defer those decisions to their
distro maintainers who provide compatible updates across all software in the
distro.

Notes: There is a blurry line between bug fixes and features and sometimes
new features do creep in.

There will never be a Python 2.8. All future development is on the 3.x
series with 2.x being in maintenance mode.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzjCkMACgkQmOOfHg372QTRFQCfXflJDxey2b48D/+LlTzU0oYy
3ZIAni20qwdjQlvnMlSau+u4CorNo/bO
=yZaX
-----END PGP SIGNATURE-----

Reply all
Reply to author
Forward
0 new messages