On SQLAlchemy 2.1.0 or 2.1.1, Fixing an N+1 Could Change Your Results | Scout Monitoring
SQLAlchemy 2.1.0 and 2.1.1 have a regression where selectinload() ignores extra conditions on some many-to-many relationships and loads rows that should be excluded. Here's who's affected, how to check, and the fix.