skillfed

sqlalchemy-json

JSON type with nested change tracking for SQLAlchemy

sqlalchemy-json v0.7.0 1.8M downloads/30d#3,536 on PyPI195
Permissive license BSD DORMANT released

What it is and what it does

sqlalchemy-json extends SQLAlchemy with two mutation-tracked JSON column types: MutableJson for top-level changes and NestedMutableJson for changes anywhere in nested objects or arrays. When you modify a JSON column value in memory, the package detects that change and ensures SQLAlchemy generates the correct UPDATE statement on commit, rather than requiring you to manually flag the column as dirty or reassign the entire value.

The package wraps SQLAlchemy's native JSON type and provides custom tracking containers (dicts and lists) that bubble modifications up to the column level. You can also use the mutable_json_type utility to customize the backing database type—for example, to use PostgreSQL's JSONB or to serialize to a non-JSON format. It has one runtime dependency: sqlalchemy.

Use it for:

  • Store and modify social media handles or metadata objects in a single JSON column without reassigning the entire column on each edit.
  • Track reference counts or nested statistics that change frequently without triggering full-column rewrites.
  • Use PostgreSQL JSONB or other database-specific JSON types while maintaining change-tracking behavior.
  • Serialize and track changes to non-JSON formats (e.g., custom string-encoded data) by providing a custom TypeDecorator.
  • Persist top-level or deeply nested list modifications (e.g., tags, keywords) as a single atomic column.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides mutation-tracked JSON column types for SQLAlchemy that detect and persist changes to JSON data at the top level or nested within objects and arrays.

Yes, if you need automatic change tracking for JSON columns in SQLAlchemy. The package is stable and has no known vulnerabilities. However, maintenance is dormant—last release was over two years ago—so verify compatibility with your specific SQLAlchemy and Python versions before adopting it in new projects. For existing codebases already using it, the low install friction and permissive license make it safe to keep.

Install

sqlalchemy-json on PyPI

pip

pip install sqlalchemy-json

uv

uv add sqlalchemy-json

poetry

poetry add sqlalchemy-json

Installing sqlalchemy-json

Before you install

Low install friction; depends only on sqlalchemy. Maintenance is dormant—last release was 1080 days ago—but the repository is not archived and the package remains stable for its scope.

License in practice

BSD license (permissive); you may use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.

Quickstart

pip install sqlalchemy-json

from sqlalchemy import Column, Text, create_engine
from sqlalchemy.orm import declarative_base
from sqlalchemy_json import MutableJson

Base = declarative_base()

class Author(Base):
    __tablename__ = 'authors'
    name = Column(Text)
    handles = Column(MutableJson)

# Changes to handles are tracked and persisted on commit
author.handles['twitter'] = '@NewHandle'
session.commit()

Verify before relying

  • Current compatibility with the latest SQLAlchemy versions (last release was August 2023)
  • Whether nested tracking works correctly with all modern Python versions supported by current SQLAlchemy

Package facts

License BSD (permissive)
Python support supports the current Python release (>= 3.6)
Install friction low — pure-Python wheel
Runtime dependencies 1 — sqlalchemy
Maintenance dormant — 1,080 days since the last release
Last repo commit
First released
Downloads 1,805,778/month — #3,536 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: sqlalchemy_json-0.7.0-py3-none-any.whl

Keywords: sqlalchemy, json, mutable

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Topic :: Database

Tags

sqlalchemy json mutation trackingmutable json column sqlalchemynested json change detectionsqlalchemy json auto-committrack json modifications databasesqlalchemy mutable dict columnjson array change tracking
sqlalchemy-extensionjson-mutation-tracking

More Database packages

psycopg2-binary

psycopg2-binary is a PostgreSQL database…

copyleft · top 1,000 on PyPI

redis

Python client library for connecting to and…

permissive · top 1,000 on PyPI

ydb

YDB Python SDK is the official client library…

permissive · top 1,000 on PyPI

snowflake-connector-python

Connects Python applications to Snowflake data…

permissive · top 1,000 on PyPI

sqlparse

sqlparse tokenizes SQL text into a tree of…

permissive · top 1,000 on PyPI

dbt-adapters

Provides base adapter protocols and shared…

permissive · top 1,000 on PyPI

sqlalchemy-serializer

Adds a `.to_dict()` method to SQLAlchemy model…

permissive · top 15,000 on PyPI

SQLAlchemy-Continuum

SQLAlchemy-Continuum adds automatic versioning…

permissive · top 5,000 on PyPI

json-source-map

Maps each value in a JSON document to its…

permissive · top 15,000 on PyPI

historydict

HistoryDict provides a persistent dictionary…

unclear · top 15,000 on PyPI

SQLAlchemy-JSONField

Provides a SQLAlchemy column type for storing…

permissive · top 5,000 on PyPI

sqlalchemy-easy-softdelete

Adds soft-deletion support to SQLAlchemy models…

permissive · top 15,000 on PyPI

sqlalchemy-mixins

Provides Active Record-style mixins for…

permissive · top 15,000 on PyPI

Flask-SQLAlchemy

Flask-SQLAlchemy integrates SQLAlchemy database…

permissive · top 1,000 on PyPI

SQLAlchemy

SQLAlchemy is a Python SQL toolkit and Object…

permissive · top 100 on PyPI

sqlalchemy-repr

Adds automatic, human-readable repr() output to…

unclear · top 15,000 on PyPI