Extract database functionality into a separately installable reflex-orm package as part of the monorepo split.
What reflex-orm Provides
rx.session — thin abstraction over SQLAlchemy engine/session, configured via REFLEX_DB_URL environment variable
reflex db subcommand — generates alembic.ini with proper configuration pointing at REFLEX_DB_URL, then delegates to standard Alembic commands
- That's it. No custom migration logic, no wrapper ORM.
What It Removes
rx.Model — gone entirely. Users bring their own model base: DeclarativeBase, SQLModel, MappedAsDataclass, or whatever they prefer
- All custom migration/autogenerate logic — standard Alembic handles this
- Any implicit schema management magic
Motivation
The current rx.Model creates a parallel ORM that's always slightly behind SQLAlchemy, confuses users who already know SQLAlchemy, and is a maintenance burden. By getting out of the way, Reflex becomes compatible with the entire SQLAlchemy ecosystem (async sessions, partitioning, sharding, read replicas) without having to support it explicitly.
Tracking
Parent: ENG-9181 (Database & ORM Standardization)
Roadmap: #2727 — Section 5a
Extract database functionality into a separately installable
reflex-ormpackage as part of the monorepo split.What
reflex-ormProvidesrx.session— thin abstraction over SQLAlchemy engine/session, configured viaREFLEX_DB_URLenvironment variablereflex dbsubcommand — generatesalembic.iniwith proper configuration pointing atREFLEX_DB_URL, then delegates to standard Alembic commandsWhat It Removes
rx.Model— gone entirely. Users bring their own model base:DeclarativeBase,SQLModel,MappedAsDataclass, or whatever they preferMotivation
The current
rx.Modelcreates a parallel ORM that's always slightly behind SQLAlchemy, confuses users who already know SQLAlchemy, and is a maintenance burden. By getting out of the way, Reflex becomes compatible with the entire SQLAlchemy ecosystem (async sessions, partitioning, sharding, read replicas) without having to support it explicitly.Tracking
Parent: ENG-9181 (Database & ORM Standardization)
Roadmap: #2727 — Section 5a