Identity-map reads vs. explicit expire/refresh when verifying externally restored rows in SQLAlchemy ORM
After restoring a database externally, an application needs to confirm that a specific row recovered from backup matches the restored database. SQLAlchemy ORM Sessions cache loaded instances in an identity map, so session.query(Model).get(pk) can return a pre-restore object without issuing a SELECT. Two documented approaches exist: rely on the identity-map r