I want to use the json1 extension for SQLite in Python. According to official documentation , this should be a downloadable extension. I got the json1.c file from the source and compiled it to json1.so according to the official instructions without errors.
$ gcc -g -fPIC -shared json1.c -o json1.so
The problem arose when I tried to download the extension in Python 2.7.12 (and 3.5.2) according to sqlite3 documentation.
>>> import sqlite3 >>> con = sqlite3.connect(":memory:") >>> con.enable_load_extension(True) >>> con.load_extension("./json1.so")
I received the following trace error message. I started the Python interpreter from the folder with the json1.so file. Although there seems to be more information due to the last colon, the following error message is complete.
Traceback (most recent call last): File "<stdin>", line 1, in <module> sqlite3.OperationalError: error during initialization:
Is it really not possible to use json1 as a loadable extension in Python? I am the only option to recompile SQLite, pysqlite2, etc., As described in this blog post by Charles Leifer?
EDIT:
As it turned out, I was getting an error because my car already had this and other extensions are already included. An error activating an activated extension caused an error. So far, all Linux computers that I have access to already have the json1 and fts5 extensions included in SQLite, which comes with Python. You can check what compilation options were used when connecting to the SQLite database and executing the following query.
PRAGMA compile_options;
source share