translating SQL into sqlalchemy is not fun.