You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Move sim's database code to the SQLAlchemy ORM #1097
Move every module that reads or writes database rows from SQLAlchemy Core to the SQLAlchemy ORM, so the rule sim.persistence.orm-only can go from ratcheted to enforced.
The rule says that code declares tables only as typed ORM mapped classes (DeclarativeBase, Mapped[...], mapped_column) and runs every statement through an ORM Session against those classes, never through Core Table objects or Connections. It lands ratcheted in #1090, with rules/baselines/orm-only.txt listing the 880 findings in today's code. A new finding fails CI, and each conversion removes its entries.
Plan
Table models and sessions: both persistence libraries' Table(...) declarations become mapped classes on one declarative base per library, and engine.py hands out a sessionmaker. Temporary aliases (household_jobs = HouseholdJob.__table__) keep the Core stores working, and the comparison with the Public API's schema keeps passing.
Service side, households: the household job and household report records and stores, and the Entrypoint's household services.
Service side, economy and budget windows: reads, inputs, find-or-create, re-runs, shared rows and result models in policyengine-simulation-persistence.
Modal side: every store in policyengine-stage12-persistence, and the executor's stage12_runtime/database_retry.py.
Activity
Require the SQLAlchemy ORM for database code, ratcheted