Code Self Study Forum

Saving JSON in Sqlite3 (Python)

Today I’m working on a Django site that is connected to slqite3 just to sketch out some ideas. I’m using JSONField for dumping some unstructured data into the database.

The Django docs mentioned that JSON is supported in sqlite3. Here’s how to check if it’s already set up:

>>> import sqlite3
>>> conn = sqlite3.connect(":memory:")
>>> cursor = conn.cursor()
>>> cursor.execute('SELECT JSON(\'{"a": "b"}\')')

I thought it was interesting way to quickly dump JSON into storage without having to set up something larger, like Postgres or Mongo. The :memory: option is also interesting.

More info here:
https://docs.python.org/3/library/sqlite3.html

While reading about sqlite, I stumbled across another project by the same developer:
https://unqlite.org/

It looks like it might be the equivalent of sqlite for noSQL.