Closed mrexodia closed 1 year ago
This came in very handy for me when I needed to use sqlalchemy (where I cannot change the code). This trick works because import sqlite3 will first look in sys.modules["sqlite3"], meaning we can replace that instance with pysqlite3.
sqlalchemy
import sqlite3
sys.modules["sqlite3"]
pysqlite3
I'm going to pass -- I'm also not sure that is correct because you probably need to set the sqlite3 to pysqlite3.dbapi2...
sqlite3
pysqlite3.dbapi2
I’ve been using this for the past month with sqlalchemy without any problems…
This came in very handy for me when I needed to use
sqlalchemy
(where I cannot change the code). This trick works becauseimport sqlite3
will first look insys.modules["sqlite3"]
, meaning we can replace that instance withpysqlite3
.