Remove `where(...) in db` (was deprecated)
Fix tests on Python 3