sqlalchemy-easy-softdelete
Easily add soft-deletion to your SQLAlchemy Models.
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has no known vulnerabilities, carries a permissive license, and solves a common ORM problem with minimal friction. The single dependency on sqlalchemy and low install overhead make it a safe addition. Use it if your application needs soft-deletion semantics; skip it if you never need to preserve deleted records or audit trails.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later; SQLAlchemy must be installed separately.
- Low install friction; single dependency on sqlalchemy.
- Actively maintained with recent releases and a stable codebase marked as Production/Stable.
License · maintenance · safety
BSD-3-Clause (permissive) — BSD-3-Clause permissive license allows commercial and private use with minimal restrictions.
last release 2026-06-16 (59 days) · last repo commit 2026-06-17 · 73 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 174,407 downloads/mo, #10,282 on PyPI
Alternatives
Verify before relying
pip install sqlalchemy-easy-softdelete
from sqlalchemy_easy_softdelete.mixin import generate_soft_delete_mixin_class
from sqlalchemy.orm import declarative_base
from sqlalchemy import Column, Integer
class SoftDeleteMixin(generate_soft_delete_mixin_class()):
pass
Base = declarative_base()
class Fruit(Base, SoftDeleteMixin):
__tablename__ = "fruit"
id = Column(Integer, primary_key=True)
# Soft-delete: session.query(Fruit).all() excludes deleted rows
fruit.delete()
# Include deleted: session.query(Fruit).execution_options(include_deleted=True).all()- Whether the automatic query rewriting works correctly with all SQLAlchemy relationship types and lazy-loading strategies.
- Performance impact of the hook on large-scale queries or complex relationship chains.
- Compatibility with SQLAlchemy's async session and asyncio workflows.
What it is and what it does
sqlalchemy-easy-softdelete is a mixin generator that adds soft-deletion semantics to SQLAlchemy models without requiring schema changes or explicit WHERE clauses in every query. Instead of deleting records, you mark them with a timestamp (by default `deleted_at`), and the library installs a query hook that automatically filters out soft-deleted rows from all SELECT statements—both in direct queries and through model relationships. You generate a customized mixin class, apply it to your models, and gain `.delete()` and `.undelete()` methods plus automatic query rewriting.
The mixin is fully configurable: you can choose the field name, its type, whether to include delete/undelete methods, and which tables the hook should ignore. This approach preserves audit trails and referential integrity while keeping deleted data invisible by default—queries return only active records unless you explicitly pass `include_deleted=True` to override the filter.
Use it for
- Implement audit trails in business applications where deleted records must remain in the database for compliance or recovery.
- Build multi-tenant systems where soft-deleted data must be excluded from user-facing queries but retained for administrative review.
- Add undo/restore functionality to applications without requiring complex transaction rollback or backup restoration.
- Maintain referential integrity in systems where cascading hard deletes would break historical reporting or linked records.
- Simplify query logic by removing the need to manually add `WHERE deleted_at IS NULL` conditions throughout the codebase.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has no known vulnerabilities, carries a permissive license, and solves a common ORM problem with minimal friction. The single dependency on sqlalchemy and low install overhead make it a safe addition. Use it if your application needs soft-deletion semantics; skip it if you never need to preserve deleted records or audit trails.
Install
sqlalchemy-easy-softdelete on PyPI
Before you install
Low install friction; single dependency on sqlalchemy. Actively maintained with recent releases and a stable codebase marked as Production/Stable.
Requires Python 3.10 or later; SQLAlchemy must be installed separately.
License in practice
BSD-3-Clause permissive license allows commercial and private use with minimal restrictions.
Quickstart
pip install sqlalchemy-easy-softdelete
from sqlalchemy_easy_softdelete.mixin import generate_soft_delete_mixin_class
from sqlalchemy.orm import declarative_base
from sqlalchemy import Column, Integer
class SoftDeleteMixin(generate_soft_delete_mixin_class()):
pass
Base = declarative_base()
class Fruit(Base, SoftDeleteMixin):
__tablename__ = "fruit"
id = Column(Integer, primary_key=True)
# Soft-delete: session.query(Fruit).all() excludes deleted rows
fruit.delete()
# Include deleted: session.query(Fruit).execution_options(include_deleted=True).all()
Verify before relying
- Whether the automatic query rewriting works correctly with all SQLAlchemy relationship types and lazy-loading strategies.
- Performance impact of the hook on large-scale queries or complex relationship chains.
- Compatibility with SQLAlchemy's async session and asyncio workflows.
Package facts
| License | BSD-3-Clause permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagesqlalchemy |
| Maintenance | Actively maintained 59 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 174,407 / month, #10,282 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Typing :: Typed |
Evidence: sqlalchemy_easy_softdelete-0.9.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “sqlalchemy soft delete”
- sqlalchemy-easy-softdeleteAdds soft-deletion support to SQLAlchemy models with automatic query…
- django-soft-deleteAdds soft deletion to Django models by marking records as deleted…
- django-safedeleteProvides soft-delete functionality for Django models, allowing…
Give your agent the search over MCP, or paste the wish link into any chat.
More Database packages
psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.
Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.
Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.
YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.
Install it if you need to connect Python applications to YDB databases.
Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.
sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.
Install it if you need to manipulate, format, or analyze SQL text programmatically.
Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.
See also django-soft-delete · django-safedelete · sqlalchemy-filters · sqlalchemy-mixins · SQLAlchemy-Continuum · sqlalchemy-repr · sqlalchemy-serializer · mock-alchemy · sqlalchemy-json · alchemy-mock