started converting queries to sqlalchemy