deprecate rx Model#6442
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
Greptile SummaryThis PR deprecates
Confidence Score: 3/5Not safe to merge without fixing the two P1 regressions in model.py Two P1 issues: a missing fallback stub for create_all (NameError when sqlalchemy absent) and unconditional sqlmodel import injection in migration scripts for pure-SQLAlchemy users (broken migrations without sqlmodel). Both affect existing code paths exposed by this refactor. reflex/model.py — specifically the sqlalchemy else-block (missing create_all stub) and _alembic_render_item (unconditional sqlmodel injection) Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[find_spec sqlalchemy] -->|True| B[get_engine / create_all / ModelRegistry / sqla_session]
A -->|False| C[_print_db_not_available stubs]
B --> D[find_spec sqlalchemy + alembic]
D -->|True| E[alembic_init / get_migration_history\nalembic_autogenerate / migrate\n_alembic_render_item adds 'import sqlmodel']
D -->|False| F[_print_db_not_available stubs]
B --> G[find_spec sqlmodel + sqlalchemy + pydantic]
G -->|True| H[Model class deprecated wrapper\n_warn_about_model_deprecation\nsession / asession / serialize_sqlmodel]
G -->|False| I[Model / session / asession not available]
H -->|delegates to| B
H -->|delegates to| E
|
| # assert migrate(autogenerate=True) #noqa: ERA001 | ||
| # assert len(list(versions.glob("*.py"))) == 4 #noqa: ERA001 |
There was a problem hiding this comment.
Commented-out test assertions should be removed
Per project convention, commented-out code should be removed before merging. These two lines (the no-op autogenerate check) have been commented out and updated in this PR — if they're intentionally skipped, they should either be deleted or replaced with a pytest.mark.skip/xfail with a comment explaining why.
Rule Used: Remove commented-out code before merging PRs. (source)
Learned From
reflex-dev/reflex-web#1619
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
No description provided.