Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade sqlite3 version using python 2.7.3 and pysqlite2 2.6.3

Good day.

I have been learning python and sqlite recently and have trouble installing the latest version of sqlite3 (3.7.14.1). I am using python 2.7.3 in windows 7 and have installed the latest pysqlite2 version (2.6.3) using the windows installer. I have used the following code to import pysqlite and check the versions and these are the results:

>>> from pysqlite2 import dbapi2 as sqlite3
>>> sqlite3.version
'2.6.3'
>>> sqlite3.sqlite_version
'3.7.6.2'

Based on the code above, the sqlite3 version used is an older one. I have downloaded the latest sqlite3.dll and have overwritten the one found in Python27\DLLs\ directory. But when I run sqlite3.sqlite_version, it still gives me the old version. However, when using the default python sqlite3 module it shows an old version of the module (2.6.0) and the latest version of the sqlite3.dll I just copied. See code below:

>>> import sqlite3
>>> sqlite3.version
'2.6.0'
>>> sqlite3.sqlite_version
'3.7.14.1'

My question is, how do I upgrade pysqlite2 2.6.3's sqlite3 3.7.14.1? Can anyone help me?

Thank you.

like image 289
Justin Paul Obsines Avatar asked Nov 06 '12 10:11

Justin Paul Obsines


1 Answers

The pysqlite2 installer you probably got from here contains sqlite3 compiled into _sqlite.pyd, it doesn't use the dll found in the DLLs directory (that one is only uset by the sqlite3 module).

So if you want to upgrade the sqlite version used, you'll have to recompile pysqlite2 yourself.

Or, as pysqlite2 is virtually identical to sqlite3, you could also replace the complete package with a file pysqlite2.py conaining only:

from sqlite3 import *
like image 107
mata Avatar answered Oct 07 '22 02:10

mata