I'd like to use a very recent version of the sqlite3 shared library, directly compiled from the sources from https://www.sqlite.org.
Overwriting /usr/lib/x86_64-linux-gnu/libsqlite3.so
or libsqlite3.so.0.8.6
with the new compiled library seems like a bad idea because it could break some of the OS tools - that use Python and the standard sqlite3 module and don't like a new version of this shared library.
Question: how can I duplicate the stdlib Python module sqlite3
into a module named sqlite3custom
that, instead of using /usr/lib/python3.5/lib-dynload/_sqlite3.cpython-35m-x86_64-linux-gnu.so
would use /path/to/my/custom/sqlite.so
?
Then I would use import sqlite3custom
in my code with exactly the same API than sqlite3
, and this would avoid to touch to the built-in sqlite3 module.
Benefit: we could even have both in the same code, to do comparisons:
import sqlite3
print(sqlite3.sqlite_version) # 3.23.1
import sqlite3custom
print(sqlite3custom.sqlite_version) # 3.36 (2021-06-18), compiled from source
Note: this is linked but slightly different to Upgrade Python's sqlite3 on Debian and Multiple versions of Sqlite3 for Python on the same server.