I'm trying to access the json1 extension in sqlite3 in python 3.6 in linux.
I see from here: https://docs.python.org/2/library/sqlite3.html#sqlite3.Connection.enable_load_extension
I can run:
# Load the fulltext search extension
con.execute("select load_extension('./fts3.so')")
# alternatively you can load the extension using an API call:
# con.load_extension("./fts3.so")
So, I assume similar should be possible with:
con.execute("select load_extension('./json1.so')")
If I can track down where that lives. But I cannot find json1.so in the sqlite3 source.
A couple places I have looked for answers:
First
Python - SQLite JSON1 load extension
gcc -g -fPIC -dynamiclib sqlite-src-3140100/ext/misc/json1.c -o json1
Looks good, but source of sqlite no longer contains an /ext/ or /ext/misc/ directory, so I can't compile this myself.
I am downloading via:
curl -O https://www.sqlite.org/2018/sqlite-autoconf-3240000.tar.gz
tar -xvzf sqlite-autoconf-3240000.tar.gz
Second
http://charlesleifer.com/blog/using-the-sqlite-json1-and-fts5-extensions-with-python/
I tried this approach, and starts off looking good, but the step where the custom sqlite3 gets called into the python wrapper when re-compiled uses a library that does not support python3:
pysqlite is not supported on Python 3. When using Python 3, use the sqlite3 module from the standard library.