-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Simplify rx.session and reflex db CLI #6245
Copy link
Copy link
Open
Labels
roadmaphttps://github.com/reflex-dev/reflex/issues/2727https://github.com/reflex-dev/reflex/issues/2727
Description
Simplify the database session management and CLI tooling to delegate to standard SQLAlchemy/Alembic rather than wrapping them.
rx.session Changes
- Becomes a thin context manager over
sqlalchemy.orm.Session - Configured via
REFLEX_DB_URLenvironment variable (or[tool.reflex]config) - No custom session subclass, no framework-specific session logic
- Supports both sync and async sessions via standard SQLAlchemy APIs
reflex db CLI Changes
reflex db init→ generates a standardalembic.iniandalembic/directory, pre-configured withREFLEX_DB_URLreflex db makemigrations→ delegates toalembic revision --autogeneratereflex db migrate→ delegates toalembic upgrade head- No custom migration/autogenerate logic — standard Alembic handles everything
- Users who outgrow the convenience wrapper can use
alembicdirectly with zero friction
Motivation
The current implementation wraps Alembic with custom logic that occasionally diverges from standard behavior, creating confusion for users familiar with Alembic. By delegating to standard tooling, we reduce maintenance burden and make the Reflex database experience identical to the broader Python ecosystem.
Tracking
Parent: ENG-9181 (Database & ORM Standardization)
Roadmap: #2727 — Section 5
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
roadmaphttps://github.com/reflex-dev/reflex/issues/2727https://github.com/reflex-dev/reflex/issues/2727