From June 2013 only the following pysqlite src distributions are available
belle7 before and after static amalgamation install:
[blyth@belle7 pysqlite-2.6.3]$ pysqlite-version
('/usr/lib/python2.4/site-packages/pysqlite2/dbapi2.pyc', '3.3.6', (3, 3, 6), '2.3.3', (2, 3, 3))
[blyth@belle7 pysqlite-2.6.3]$ pysqlite-version
('/usr/lib/python2.4/site-packages/pysqlite2/dbapi2.pyc', '3.7.17', (3, 7, 17), '2.6.3', (2, 6, 3))
NB the SQLite version 3.7.17 is distinct from the pysqlite one 2.6.3
Old Redhat nodes use a python sqlite binding for their yum installations which makes it problematic to upgrade to newer sqlite and python sqlite bindings using rpm OR yum techniques.
The older versions live under python module sqlite:
[blyth@cms01 yum]$ /usr/bin/python -c "import sqlite as _ ; print (_.__file__,_._sqlite.sqlite_version(),_._sqlite.sqlite_version_info())"
('/usr/lib/python2.3/site-packages/sqlite/__init__.pyc', '3.3.6', (3, 3, 6))
To get around the impasse install pysqlite2 from its source distribution in build_static mode, in order to grab the lastest sqlite3 amalgamation and compile that directly into the python extension, avoiding issues of linking against the old shared sqlite libs, or accidentally upgrading them.
Build like that using the pysqlite- bash functions:
cd ~/env
svn up # update env
env-
pysqlite-
pysqlite-get # download the pysqlite source distribute
pysqlite-get-amalgamation http://sqlite.org/2013/sqlite-amalgamation-3071700.zip
# determine the amalgamation url by perusing http://sqlite.org/download.html
pysqlite-static-install
# installs into the system python at /usr/bin/python
pysqlite-version
# check the version is as expected for system python /usr/bin/python
The pysqlite-version function does:
[blyth@cms01 yum]$ /usr/bin/python -c "from pysqlite2 import dbapi2 as _ ; print (_.__file__,_.sqlite_version,_.sqlite_version_info,_.version,_.version_info) "
('/usr/lib/python2.3/site-packages/pysqlite2/dbapi2.pyc', '3.7.17', (3, 7, 17), '2.6.3', (2, 6, 3))
Note that the updated version is typically accessed via python import:
from pysqlite2 import dbapi2 as sqlite
This means that existing users of the ancient python sqlite bindings such as yum are not disturbed, and can continue to:
import sqlite
It is static in the sense that it doesnt use the system sqlite shared lib, but rather uses the SQLite amalgamation statically compiled into the pysqlite2 extension.
[blyth@cms01 pysqlite-2.6.3]$ /usr/bin/python setup.py build_static
running build_static
running build_py
running build_ext
building 'pysqlite2._sqlite' extension
...
gcc -pthread -shared
build/temp.linux-i686-2.3/src/module.o
build/temp.linux-i686-2.3/src/connection.o
build/temp.linux-i686-2.3/src/cursor.o
build/temp.linux-i686-2.3/src/cache.o
build/temp.linux-i686-2.3/src/microprotocols.o
build/temp.linux-i686-2.3/src/prepare_protocol.o
build/temp.linux-i686-2.3/src/statement.o
build/temp.linux-i686-2.3/src/util.o
build/temp.linux-i686-2.3/src/row.o
build/temp.linux-i686-2.3/amalgamation/sqlite3.o
-o build/lib.linux-i686-2.3/pysqlite2/_sqlite.so