Want to update sqlite that came with python

I’m currently running Python 3.8.2. I’m not updating again until a version of wxPython is released that will run under the newer version. The version of sqlite that comes with Python is 2.6.0 (used by import sqlite3). I have tried several ways to update this to the 3.7.x version (or really, anything newer than 2.6.0) and everything leaves me at 2.6.0.

Running pip list doesn’t even show a sqlite package installed at all which is odd since I can do import sqlite3 and use all the sqlite functionality.

Can anyone tell me how to update sqlite to a more recent version?

You’re checking the wrong version number :slight_smile:

The sqlite3 module was forked off of the pysqlite project back in 2005 or 2006 IIRC. The version attribute comes from the pysqlite version, not the SQLite library version. To see what version the underlying SQLite library has, check the sqlite_version attribute:

$ python3.8
Python 3.8.12 (default, Oct 13 2021, 06:42:42) 
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.version
'2.6.0'
>>> sqlite3.sqlite_version
'3.37.0'
>>> sqlite3.sqlite_version_info  # it is also available as a tuple
(3, 37, 0)

(As you might guess, my Python 3.8 is not the official Python 3.8 binary, given the very recent SQLite version number. IIRC, the official Python 3.8 binary comes with SQLite 3.35.5.)

For the record, pysqlite was fairly regularly updated on the outside of the CPython standard library. The most recent release is pysqlite 2.8.3 in 2016: Tags · ghaering/pysqlite · GitHub

Aaaarrrggghhhh. As clear as anything else in this industry. And I should know. I’ve been in it since the 70s

Thanks for clearing that up.

1 Like

Glad to help :slight_smile: Checking the docs, I see that it is actually documented as well:

https://docs.python.org/3.8/library/sqlite3.html#sqlite3.sqlite_version

Looks like sqlite3.version is unnecessary and misleading. Would it make sense to deprecate it?

2 Likes

@storchaka brought this up on python-dev a while ago (generally, not especially the sqlite3 module):

https://mail.python.org/archives/list/python-dev@python.org/thread/KBU4EU2JULXSMUZULD5HJJWCGOMN52MK/#6PUP4FORLNX4TAEET42C6YN4SGR22SSU

EDIT: That thread was specifically about the __version__ dunder methods, not the plain version as seen in sqlite3. I see I was corrected in that thread :laughing:

I’d happily deprecate it now in 3.11 alpha.

Right… I’d also happily deprecate it in 3.12 alpha :laughing: I’ll create an issue right away, so I don’t forget about it again.

UPDATE: I created gh-93370