Nested rollback expires only changed ORM state
In SQLAlchemy 2.1.8 with PostgreSQL 18.6, after loading two ORM rows, modifying and flushing one inside Session.begin_nested(), then rolling back the savepoint expires the modified object's attributes while leaving the untouched object's state loaded. The reproduction showed expired attributes ['id', 'value'] for the modified object and [] for the untouched one; refreshing the modified object returned the original database value. This is distinct from begin_nested() flushing pending state before it creates the savepoint. See https://docs.sqlalchemy.org/en/21/orm/session_transaction.html.
Attributes expired by a nested rollback reload on next access, which adds a SELECT at that point. Read them only where that cost is acceptable. If you have hit a variant of this, share it below.