On python3.7.4 loading sqlite3 modules and requesting to enable_load_extension gives:
import sqlite3
conn=sqlite3.connect("./tests/data/ne_110m_admin_0_countries.sqlite")
conn.enable_load_extension(True)
AttributeError: 'sqlite3.Connection' object has no attribute 'enable_load_extension'
I understand the default Ubuntu sqlite3 package is building with load_extension deactivated. I have followed this guideline: https://charlesleifer.com/blog/compiling-sqlite-for-use-with-python-applications/
Basically, compiled sqlite3 with flag: -DSQLITE_ENABLE_LOAD_EXTENSION, using pyenv and building python 3.7.4 on verbose mode I can see the load extension flag being used, also following hte above tutorial and reinstalling pysqlite3 on pyenv
Running python on verbose mode:
>>> import sqlite3
# /home/jesus/.pyenv/versions/3.7.4/lib/python3.7/sqlite3/__pycache__/__init__.cpython-37.pyc matches /home/jesus/.pyenv/versions/3.7.4/lib/python3.7/sqlite3/__init__.py
The path to the module is correct.
Using the sqlite3 client:
jesus@earth:~/.pyenv/versions/3.7.4/bin$ sqlite3
SQLite version 3.31.0 2019-11-16 12:04:38
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> SELECT sqlite_compileoption_used('ENABLE_LOAD_EXTENSION');
1
I see that sqlite was build with the proper options
Never the the less I continue to have the same error of: AttributeError: 'sqlite3.Connection' object has no attribute 'enable_load_extension'
Update Requesting by SQL, if the library was compiled with load extension loading the reply is positive
cursor=conn.cursor()
res=cursor.execute("SELECT sqlite_compileoption_used('ENABLE_LOAD_EXTENSION');")
res.fetchall() [(1,)]
I am lost on what more can I do to debug the problem. This is happening on pyenv build
Any tips??
[python] sqlite3 version