advanced-alchemy
Advanced Alchemy
Match-Your-Framework — read first
advanced-alchemy ships first-party extensions for five web frameworks. If your project uses one of these, jump directly to the matching integration guide and skip the others:
- Litestar —
SQLAlchemyPluginwith full DI, session store, CLI. The rest of this SKILL.md covers Litestar by default; also seereferences/litestar_plugin.md. - FastAPI →
references/fastapi-integration.md—AdvancedAlchemy(config=..., app=app),Depends(alchemy.provide_session())DI,provide_service()/provide_filters(), Alembic CLI viaassign_cli_group. - Flask →
references/flask-integration.md—AdvancedAlchemy(config=..., app=app)orinit_app()factory, pull-basedalchemy.get_sync_session(), async-via-portal. - Sanic →
references/sanic-integration.md—AdvancedAlchemy(sqlalchemy_config=..., sanic_app=app)(note:sqlalchemy_config=kwarg, notconfig=), sanic-ext DI,request.ctxsessions. - Starlette →
references/starlette-integration.md—AdvancedAlchemy(config=..., app=app),request.statesession access, lifespan wrapping.
Shared topics that apply to every framework live in references/commit-modes.md (commit_mode="manual" / "autocommit" / "autocommit_include_redirect") and references/multi-database.md (bind-key pattern). Read the framework guide first, then those for depth.
The rest of this SKILL.md covers framework-agnostic topics: base classes, repositories, services, filters, custom types, caching, replicas, operations, and Alembic migrations.
Overview
Advanced Alchemy is NOT a raw ORM — it is a service/repository layer built on top of SQLAlchemy 2.0+ with opinionated base classes, audit mixins, and deep framework integrations (Litestar, FastAPI, Flask, Sanic). It provides: