--- id: sqlalchemy-mixins version: "2.0.5" license: MIT license_treatment: permissive maintenance: dormant --- # sqlalchemy-mixins — Active Record, Django-like queries, nested eager load and beauty __repr__ for SQLAlchemy License: permissive · Maintenance: dormant · Downloads: 410.3K/mo ## What it is and what it does sqlalchemy-mixins adds Active Record and Django-inspired ORM patterns on top of SQLAlchemy's Data Mapper architecture. Instead of writing session.query(User).filter(...).all(), you call User.where(...).all() directly on the model class. The package provides mixins you inherit into your model base class to gain CRUD shortcuts (create, update, delete, find), query helpers (all, first, where), eager-load control (with_joined, with_subquery), and automatic timestamp tracking. It's designed to feel familiar to developers coming from Django or Eloquent ORM while remaining framework-agnostic. The library handles the session plumbing internally once you set it up, reducing boilerplate. It covers serialization to dict, nested eager loading with joinedload and subqueryload, and filtering by relations using Django-style double-underscore syntax. Use it for: - Migrate from Django ORM to SQLAlchemy while keeping familiar query syntax and reducing code rewrite effort. - Build Flask or FastAPI apps where you want Active Record convenience without a full framework ORM. - Reduce boilerplate in SQLAlchemy projects by replacing repetitive session.query() chains with model methods. - Implement eager loading strategies (nested joins, subqueries) with cleaner syntax than raw SQLAlchemy. - Add automatic created_at and updated_at timestamp tracking to models without manual column management. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides Active Record-style mixins for SQLAlchemy ORM, enabling Django-like query syntax, eager loading, and CRUD operations on model classes. Yes, if you are starting a new SQLAlchemy project and prefer Active Record patterns or migrating from Django. No, if you need active maintenance—the dormant status (last release 2023-08-29) means security patches and compatibility updates are unlikely. Suitable for stable, low-change codebases; risky for projects requiring ongoing support. ## Install pip install sqlalchemy-mixins uv add sqlalchemy-mixins poetry add sqlalchemy-mixins ## Installing sqlalchemy-mixins Before you install: Low friction install with three straightforward runtime dependencies. Maintenance is dormant—last release was 2023-08-29 and last commit 2024-09-08—so expect no active bug fixes or feature updates. License in practice: MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions. Quickstart: pip install sqlalchemy-mixins from sqlalchemy_mixins import AllFeaturesMixin class User(Base, AllFeaturesMixin): pass BaseModel.set_session(session) bob = User.create(name='Bob') user = User.find(1) User.all() Requires SQLAlchemy session to be initialized via set_session() and autocommit must be enabled on the session for CRUD operations to work. Verify before relying: - Compatibility with current SQLAlchemy versions beyond what classifiers claim - Whether dormant status means the package is stable or abandoned for practical purposes - Performance characteristics compared to raw SQLAlchemy queries in production workloads ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: dormant - Downloads: 410.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags sqlalchemy active record pattern, django-like orm queries, sqlalchemy eager load mixins, sqlalchemy crud helpers, sqlalchemy query builder, sqlalchemy model mixins, activerecord for sqlalchemy, orm-helper, activerecord-pattern, django-migration [View on SkillFed](https://skillfed.io/packages/sqlalchemy-mixins) · [View on PyPI](https://pypi.org/project/sqlalchemy-mixins/)